* [PATCH] Add history to Custom commands
@ 2022-01-20 22:42 Ivan Sokolov
2022-01-21 9:57 ` Lars Ingebrigtsen
0 siblings, 1 reply; 7+ messages in thread
From: Ivan Sokolov @ 2022-01-20 22:42 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 7 bytes --]
Subj.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-cus-edit.el-add-history-when-possible.patch --]
[-- Type: text/x-patch, Size: 2790 bytes --]
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Add history to Custom commands
2022-01-20 22:42 [PATCH] Add history to Custom commands Ivan Sokolov
@ 2022-01-21 9:57 ` Lars Ingebrigtsen
2022-01-21 10:21 ` Ivan Sokolov
0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-21 9:57 UTC (permalink / raw)
To: Ivan Sokolov; +Cc: emacs-devel
Ivan Sokolov <ivan-p-sokolov@ya.ru> writes:
> Subj.
I'm not sure whether it makes sense to have separate histories for these
commands -- it's nice if you're expected to customise the same things
several times, but not if you have the things in the general history.
So I don't know. Any opinions?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Add history to Custom commands
2022-01-21 9:57 ` Lars Ingebrigtsen
@ 2022-01-21 10:21 ` Ivan Sokolov
2022-01-21 17:57 ` Stefan Monnier
0 siblings, 1 reply; 7+ messages in thread
From: Ivan Sokolov @ 2022-01-21 10:21 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: emacs-devel
Lars Ingebrigtsen <larsi@gnus.org> writes:
> I'm not sure whether it makes sense to have separate histories for these
> commands -- it's nice if you're expected to customise the same things
> several times, but not if you have the things in the general history.
Maybe I was too hasty with this patch. I was using customize-variable
instead of revert-buffer, which is unavailable for Custom buffers, and
some other commands without dedicated history variables. All of the
above has led to massive abuse of M-p.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Add history to Custom commands
2022-01-21 10:21 ` Ivan Sokolov
@ 2022-01-21 17:57 ` Stefan Monnier
2022-01-22 1:52 ` Ivan Sokolov
0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2022-01-21 17:57 UTC (permalink / raw)
To: Ivan Sokolov; +Cc: Lars Ingebrigtsen, emacs-devel
> Maybe I was too hasty with this patch. I was using customize-variable
> instead of revert-buffer, which is unavailable for Custom buffers, and
[...]
Maybe a more direct fix is to improve Custom so it does provide a proper
`revert-buffer-function`?
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Add history to Custom commands
2022-01-21 17:57 ` Stefan Monnier
@ 2022-01-22 1:52 ` Ivan Sokolov
2022-01-22 3:47 ` Stefan Monnier
0 siblings, 1 reply; 7+ messages in thread
From: Ivan Sokolov @ 2022-01-22 1:52 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Lars Ingebrigtsen, emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Maybe a more direct fix is to improve Custom so it does provide a proper
> `revert-buffer-function`?
That was the idea, but turns out that you had already done it last July.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Add history to Custom commands
2022-01-22 1:52 ` Ivan Sokolov
@ 2022-01-22 3:47 ` Stefan Monnier
2022-01-22 8:48 ` Ivan Sokolov
0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2022-01-22 3:47 UTC (permalink / raw)
To: Ivan Sokolov; +Cc: Lars Ingebrigtsen, emacs-devel
Ivan Sokolov [2022-01-22 04:52:54] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> Maybe a more direct fix is to improve Custom so it does provide a proper
>> `revert-buffer-function`?
> That was the idea, but turns out that you had already done it last July.
Hmm... too bad I didn't notify myself when I did.
Oh, I see I did it while I was masquerading as Lars,
that explains it ;-)
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Add history to Custom commands
2022-01-22 3:47 ` Stefan Monnier
@ 2022-01-22 8:48 ` Ivan Sokolov
0 siblings, 0 replies; 7+ messages in thread
From: Ivan Sokolov @ 2022-01-22 8:48 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Lars Ingebrigtsen, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 293 bytes --]
On January 22, 2022 3:47:44 AM UTC, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>Hmm... too bad I didn't notify myself when I did.
>Oh, I see I did it while I was masquerading as Lars,
>that explains it ;-)
Oof, I double checked who I was replying from two people and still missed
[-- Attachment #2: Type: text/html, Size: 361 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-01-22 8:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-20 22:42 [PATCH] Add history to Custom commands Ivan Sokolov
2022-01-21 9:57 ` Lars Ingebrigtsen
2022-01-21 10:21 ` Ivan Sokolov
2022-01-21 17:57 ` Stefan Monnier
2022-01-22 1:52 ` Ivan Sokolov
2022-01-22 3:47 ` Stefan Monnier
2022-01-22 8:48 ` Ivan Sokolov
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.