From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ivan Sokolov Newsgroups: gmane.emacs.devel Subject: [PATCH] Add history to Custom commands Date: Fri, 21 Jan 2022 01:42:48 +0300 Message-ID: <87y23ajafr.fsf@ya.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34078"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jan 21 01:41:07 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nAhzH-0008i1-3F for ged-emacs-devel@m.gmane-mx.org; Fri, 21 Jan 2022 01:41:07 +0100 Original-Received: from localhost ([::1]:50456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nAhzF-00022P-5J for ged-emacs-devel@m.gmane-mx.org; Thu, 20 Jan 2022 19:41:05 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:49732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nAg92-0004FK-Iz for emacs-devel@gnu.org; Thu, 20 Jan 2022 17:43:05 -0500 Original-Received: from forward104j.mail.yandex.net ([5.45.198.247]:55474) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nAg8z-0007OO-KG for emacs-devel@gnu.org; Thu, 20 Jan 2022 17:43:03 -0500 Original-Received: from iva6-b9aa172731b6.qloud-c.yandex.net (iva6-b9aa172731b6.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:9a88:0:640:b9aa:1727]) by forward104j.mail.yandex.net (Yandex) with ESMTP id 401C02F985F1 for ; Fri, 21 Jan 2022 01:42:49 +0300 (MSK) Original-Received: from iva4-50c21cb1cb18.qloud-c.yandex.net (iva4-50c21cb1cb18.qloud-c.yandex.net [2a02:6b8:c0c:1510:0:640:50c2:1cb1]) by iva6-b9aa172731b6.qloud-c.yandex.net (mxback/Yandex) with ESMTP id oJ4Iu407Vy-gneGLqCv; Fri, 21 Jan 2022 01:42:49 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ya.ru; s=mail; t=1642718569; bh=YNig+tLKbc02KalCyzr1wIk6Htdhsjlxy6IJ9uDDdcA=; h=Date:Subject:To:From:Message-ID; b=ujwEEGTTeLmBjvqD8E/PlQkKuRbCyy6rPNRqjYqV75t/i5C7Xsmrj7xwfm7uDcC7m huUOrengJJr5mxv7gtGlvdndF5k1fUsQ+6dvDFi7xMgfTZY9L1EEq4PB17KarV1qlk pF88mXaIoitu9yZfPfNbc0LrGG0sPdMicatQV0pU= Authentication-Results: iva6-b9aa172731b6.qloud-c.yandex.net; dkim=pass header.i=@ya.ru Original-Received: by iva4-50c21cb1cb18.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id Wnm0X8deV7-gmPql6E6; Fri, 21 Jan 2022 01:42:48 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) X-Yandex-Fwd: 2 Received-SPF: pass client-ip=5.45.198.247; envelope-from=ivan-p-sokolov@ya.ru; helo=forward104j.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:285064 Archived-At: --=-=-= Content-Type: text/plain Subj. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-cus-edit.el-add-history-when-possible.patch >From ea2238e6506406419140be48f820d010cb906528 Mon Sep 17 00:00:00 2001 From: Ivan Sokolov 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 --=-=-=--