[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Add history to Custom commands
From: |
Ivan Sokolov |
Subject: |
[PATCH] Add history to Custom commands |
Date: |
Fri, 21 Jan 2022 01:42:48 +0300 |
Subj.
>From ea2238e6506406419140be48f820d010cb906528 Mon Sep 17 00:00:00 2001
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Date: Fri, 21 Jan 2022 01:39:40 +0300
Subject: [PATCH] cus-edit.el: add history when possible
---
lisp/cus-edit.el | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 3e350c611a..88e75c3273 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -464,6 +464,15 @@ custom-field-keymap
;;; Utilities.
+(defvar custom-mode-history nil
+ "History for `customize-mode'.")
+
+(defvar custom-group-history nil
+ "History of custom groups input.")
+
+(defvar custom-variable-history nil
+ "History of custom variables input.")
+
(defun custom-split-regexp-maybe (regexp)
"If REGEXP is a string, split it to a list at `\\|'.
You can get the original back from the result with:
@@ -477,15 +486,16 @@ custom-split-regexp-maybe
(defun custom-variable-prompt ()
"Prompt for a custom variable, defaulting to the variable at point.
Return a list suitable for use in `interactive'."
- (let* ((v (variable-at-point))
- (default (and (symbolp v) (custom-variable-p v) (symbol-name v)))
- (enable-recursive-minibuffers t)
- val)
- (setq val (completing-read (format-prompt "Customize variable" default)
- obarray 'custom-variable-p t nil nil default))
- (list (if (equal val "")
- (if (symbolp v) v nil)
- (intern val)))))
+ (let* ((v (variable-at-point))
+ (default (and (symbolp v) (custom-variable-p v) (symbol-name v)))
+ (enable-recursive-minibuffers t)
+ val)
+ (setq val (completing-read (format-prompt "Customize variable" default)
+ obarray 'custom-variable-p t nil
+ 'custom-variable-history default))
+ (list (if (equal val "")
+ (if (symbolp v) v nil)
+ (intern val)))))
(defvar custom-actioned-widget nil
"Widget for which to show the menu of available actions.
@@ -1128,7 +1138,8 @@ customize-mode
(completing-read (format-prompt "Mode" (and group major-mode))
obarray
'custom-group-of-mode
- t nil nil (if group (symbol-name major-mode))))))))
+ t nil 'customize-mode-history
+ (if group (symbol-name major-mode))))))))
(customize-group (custom-group-of-mode mode)))
(defun customize-read-group ()
@@ -1139,7 +1150,7 @@ customize-read-group
(or (and (get symbol 'custom-loads)
(not (get symbol 'custom-autoload)))
(get symbol 'custom-group)))
- t)))
+ t nil 'customize-group-history)))
;;;###autoload
(defun customize-group (&optional group other-window)
--
2.34.1
- [PATCH] Add history to Custom commands,
Ivan Sokolov <=