From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gabriel do Nascimento Ribeiro Newsgroups: gmane.emacs.devel Subject: [PATCHES] Minor patches for Remember, Minibuffer and Tab Bar Date: Sat, 05 Dec 2020 01:26:25 -0300 Message-ID: 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="28113"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 05 05:42:34 2020 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 1klPP0-0007Cm-Ai for ged-emacs-devel@m.gmane-mx.org; Sat, 05 Dec 2020 05:42:34 +0100 Original-Received: from localhost ([::1]:56618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1klPOz-0007hT-CT for ged-emacs-devel@m.gmane-mx.org; Fri, 04 Dec 2020 23:42:33 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56802) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1klPOM-0007Gi-Ti for emacs-devel@gnu.org; Fri, 04 Dec 2020 23:41:55 -0500 Original-Received: from mail-mw2nam10olkn2067.outbound.protection.outlook.com ([40.92.42.67]:31969 helo=NAM10-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1klPOG-0000o3-DW for emacs-devel@gnu.org; Fri, 04 Dec 2020 23:41:54 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UjIlbTBCEjUsUUUpqDTz3Ty1o93nRTcyPwFIwGCztiwfa2IB0LhPI/6dpBmZA4hh7ve4jlsAQThjX3eIS1ZP9oXQbkuURr7kMS+qwIPf4/29y0UnWduzQ83KSwpmCXGYOFzqrtCt0d+7Z376nhCwjC4ug8/IQEJqNyFLzwFrvkkpyRD5/Hr0HwNcbU7z3Hc8agWI6FTPqcLGPV8JHZgzPO3sksu8qS2ock+bn9HUQf8NLbe/nF0s/yD5BdJFACqWdHZ4C5jTm8VCgTbXQfc6L2ay0AAPCTEbp7XwmlZ9HiJlvQIwrvxQ+7r5pM3l9SweNErw1mB7E/gse991LZrz9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c5ShiSvz3zw003dBn9JiZN0nuifO+mFE+exTFEYauSU=; b=Cm4avbWGSUHCYYu/5Re9+CLbPVc7RasqKe3UBw6lpi6oYigNDgye/47hqgIpv8rthmJldkBSZDVUSZenNa0GiszLMhLOQcked66AsLRzBfYxNvMuvANxK0Vpvtugrvq6dcq9jANUv8FBe6j9ZSFM8ZF+JLOuEQv+BqJYbYwkNcjcORI0GcE2Xs2B61gJnvfkgjj7NfmysAhi5h8qtXpz68y9cAxvSKsfalr876nuAbDXbE0GBxE9LSBYKTNW9+3yeXzJcUse08GwQ2KteutJJdC1nMlFOIgwd91Ah2iwtc2rzvJlZPzD3AWCIXcye+6TvTegNOrg0+msXMaRmBJoMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c5ShiSvz3zw003dBn9JiZN0nuifO+mFE+exTFEYauSU=; b=pLd/7T36zsJ8vAsIGxC/xqTO8JOa5KJg3TCft4yXZXWhdgfdUe38m5HGZrPWvmDrWSHaQdwCwISZbE6NsJuLgWd2hJiSG3XyhPzlwcC5Yi+vjeUQLPetaJc1n98ZmJRdGnQEJ6hfvCYFXbttQVtAn7/pXFxWYJWv5f9zcwaYEWLByiPfDTWn6XYV4GbJfhE8+MJMqTi4/cNTY8fzPczNod2a38xlMp05mWugP7wShE9EDjBvcfg794OL6eKw+OKWpmsEHsYsYdHtkEs3DCJXm6HsFIEge1l8qvhkm/Auq4TkPMB66MJg4qRTfExKCwY6Gg+ytJx8U2L+yN9AMNMFOw== Original-Received: from DM6NAM10FT034.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e86::51) by DM6NAM10HT023.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e86::199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.20; Sat, 5 Dec 2020 04:26:43 +0000 Original-Received: from CH2PR01MB5879.prod.exchangelabs.com (2a01:111:e400:7e86::41) by DM6NAM10FT034.mail.protection.outlook.com (2a01:111:e400:7e86::372) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.20 via Frontend Transport; Sat, 5 Dec 2020 04:26:43 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:C5365187BC83CEC50FCEEB976BEFBB566BC9C4F81DA92B73C438DC8805EC3572; UpperCasedChecksum:CC6C4C3729EB10DD579861F7A3C61D024A7BA7AA78815BC0479E63B05618D362; SizeAsReceived:7329; Count:43 Original-Received: from CH2PR01MB5879.prod.exchangelabs.com ([fe80::d51d:8cbe:370a:39ac]) by CH2PR01MB5879.prod.exchangelabs.com ([fe80::d51d:8cbe:370a:39ac%7]) with mapi id 15.20.3611.031; Sat, 5 Dec 2020 04:26:43 +0000 X-TMN: [oBnTeexz8wvrtK4j4i7rVrrqRhPf+RXIYsq4awQXNnM84AUMnAmeZ3z0dVw4iCaO] X-ClientProxiedBy: CP2P152CA0027.LAMP152.PROD.OUTLOOK.COM (2603:10d6:101:15::13) To CH2PR01MB5879.prod.exchangelabs.com (2603:10b6:610:3c::12) X-Microsoft-Original-Message-ID: <878sacc1zi.fsf@hotmail.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from precision5540 (2804:431:c7f3:50e5:55b5:e69a:4d71:d7a) by CP2P152CA0027.LAMP152.PROD.OUTLOOK.COM (2603:10d6:101:15::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Sat, 5 Dec 2020 04:26:41 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 43 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 90b4af61-6879-4e84-ddc9-08d898d5f81e X-MS-TrafficTypeDiagnostic: DM6NAM10HT023: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BB9wqMlCd8EcU+w3Q5/FaQ/kJMoO3IPYt91r9jks2xgAd3EBPTpktl4LQ9xr8MeoUhnf0Jm28W874K+Sqkg3Llq1Hy1ShrJAgtAs/AE8+tWDIeAeKkEDQR9s0a2Bp1IDizCSNdgZcWqGA//nSPjDRQloFyuiSNtpsXMrnYbsBGhWQzfwaKp7NtW3IZ4k+DbS1jPDFF1bYfuJSiQX6ModnQ== X-MS-Exchange-AntiSpam-MessageData: 5W9DdG9yn5dLABKsYbl6YwSzFGfK0lvpg0xIpC8rSaacsFIZ/WxS2Pe+C+jz8GfZEIpl23kl8sIozAt0QbfU/gK+8GXhH0TkOmiyrgOqmVaLa84N+eoQJPbtKlecjMSRBk1J8JS1dIhSi+gEOu0dPaoIbpwuVSIxwI7lGbWJuZCSGstuC+CSVwdQ5Urkgd+7Dd/5t5KOSy1Vr4b3ugo1iw== X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2020 04:26:42.9974 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-Network-Message-Id: 90b4af61-6879-4e84-ddc9-08d898d5f81e X-MS-Exchange-CrossTenant-AuthSource: DM6NAM10FT034.eop-nam10.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6NAM10HT023 Received-SPF: pass client-ip=40.92.42.67; envelope-from=gabriel376@hotmail.com; helo=NAM10-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 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:260335 Archived-At: --=-=-= Content-Type: text/plain Hi, Here are some suggestions of minor patches. Hope it's useful in some way. This patch: - adds a trailing space to minibuffer depth indicator, so it has some distance from minibuffer prompt - adds a new face 'minibuffer-depth-indicator' --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-minibuffer-depth-indicator-face-and-padding.patch Content-Description: Add trailing space and new face to minnibufer depth diff --git a/lisp/mb-depth.el b/lisp/mb-depth.el index 7ee7525d9f..aa12911822 100644 --- a/lisp/mb-depth.el +++ b/lisp/mb-depth.el @@ -35,6 +35,9 @@ minibuffer-depth-indicator-function It is called with one argument, the minibuffer depth, and must return a string.") +(defface minibuffer-depth-indicator '((t :inherit highlight)) + "Face to use for minibuffer depth indicator.") + ;; An overlay covering the prompt. This is a buffer-local variable in ;; each affected minibuffer. ;; @@ -52,7 +55,10 @@ minibuffer-depth-setup (overlay-put minibuffer-depth-overlay 'before-string (if minibuffer-depth-indicator-function (funcall minibuffer-depth-indicator-function depth) - (propertize (format "[%d]" depth) 'face 'highlight))) + (concat (propertize (format "[%d]" depth) + 'face + 'minibuffer-depth-indicator) + " "))) (overlay-put minibuffer-depth-overlay 'evaporate t)))) ;;;###autoload --=-=-= Content-Type: text/plain This patch: - removes unused 'org-remember-handler' from 'remember-handler-functions' - adds a new option 'remember-item-format-function' to be used with 'remember-append-to-file'. This allows the user to specifify a custom function to format a remember item. The current format uses a hardcoded format that consists of 'remember-leader-text' + 'remember-time-format' + short description for the header and the 'buffer-string' for the body - adds a new option 'remember-diary-regexp' to extract the hardcoded and undocumented regexp used on 'remember-diary-extract-entries' - adds logic to automatically save the diary buffer on 'remember-diary-extract-entries' respecting the value of 'remember-save-after-remembering' --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-remember-add-some-options.patch Content-Description: Add some custom options to Remember diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el index 7bc7dc1762..bbe11967f0 100644 --- a/lisp/textmodes/remember.el +++ b/lisp/textmodes/remember.el @@ -221,8 +221,7 @@ remember-handler-functions :options '(remember-store-in-mailbox remember-append-to-file remember-store-in-files - remember-diary-extract-entries - org-remember-handler) + remember-diary-extract-entries) :group 'remember) (defcustom remember-all-handler-functions nil @@ -410,16 +409,28 @@ remember-time-format :group 'remember :version "27.1") +(defcustom remember-item-format-function nil + "The function to format a remembered item. +The function receives one argument, the remember text, and +should return the text to be remembered. +If nil, use default format.'" + :type 'function + :group 'remember + :version "28.1") + (defun remember-append-to-file () "Remember, with description DESC, the given TEXT." (let* ((text (buffer-string)) + (buf (find-buffer-visiting remember-data-file)) (desc (remember-buffer-desc)) - (remember-text (concat "\n" remember-leader-text - (format-time-string remember-time-format) - " (" desc ")\n\n" text + (remember-text (concat "\n" + (if remember-item-format-function + (funcall remember-item-format-function text) + (concat remember-leader-text + (format-time-string remember-time-format) + " (" desc ")\n\n" text)) (save-excursion (goto-char (point-max)) - (if (bolp) nil "\n")))) - (buf (find-buffer-visiting remember-data-file))) + (if (bolp) nil "\n"))))) (if buf (with-current-buffer buf (save-excursion @@ -502,6 +513,12 @@ remember-diary-file :type '(choice (const :tag "diary-file" nil) file) :group 'remember) +(defcustom remember-diary-regexp "^DIARY:\\s-*\\(.+\\)" + "Regexp to extract diary entries." + :type '(regexp :tag "Diary entry") + :group 'remember + :version "28.1") + (defvar calendar-date-style) ; calendar.el (defun remember-diary-convert-entry (entry) @@ -534,15 +551,18 @@ remember-diary-convert-entry ;;;###autoload (defun remember-diary-extract-entries () - "Extract diary entries from the region." + "Extract diary entries from the region based on `remember-diary-regexp'." (save-excursion (goto-char (point-min)) (let (list) - (while (re-search-forward "^DIARY:\\s-*\\(.+\\)" nil t) + (while (re-search-forward remember-diary-regexp nil t) (push (remember-diary-convert-entry (match-string 1)) list)) (when list (diary-make-entry (mapconcat 'identity list "\n") - nil remember-diary-file)) + nil remember-diary-file t) + (when remember-save-after-remembering + (with-current-buffer (find-buffer-visiting diary-file) + (save-buffer)))) nil))) ;; Continue processing ;;; Internal Functions: --=-=-= Content-Type: text/plain This patch: - adds a new option 'tab-bar-history-buttons-show' to control visibility of tab-bar-history back and forward buttons, similar to 'tab-bar-new-button-show' and 'tab-bar-close-button-show' --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-tab-bar-history-buttons-show.patch Content-Description: Adds options to hide tab-bar history buttons diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 2604955224..05611b48bb 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -296,6 +296,16 @@ tab-bar-back-button (defvar tab-bar-forward-button " > " "Button for going forward in tab history.") +(defcustom tab-bar-history-buttons-show t + "Show back and forward buttons when `tab-bar-history-mode' is enabled." + :type 'boolean + :initialize 'custom-initialize-default + :set (lambda (sym val) + (set-default sym val) + (force-mode-line-update)) + :group 'tab-bar + :version "28.1") + (defcustom tab-bar-tab-hints nil "Show absolute numbers on tabs in the tab bar before the tab name. This helps to select the tab by its number using `tab-bar-select-tab' @@ -415,7 +425,7 @@ tab-bar-make-keymap-1 (tabs (funcall tab-bar-tabs-function))) (append '(keymap (mouse-1 . tab-bar-handle-mouse)) - (when tab-bar-history-mode + (when (and tab-bar-history-mode tab-bar-history-buttons-show) `((sep-history-back menu-item ,separator ignore) (history-back menu-item ,tab-bar-back-button tab-bar-history-back --=-=-= Content-Type: text/plain This patch: - adds a new option 'tab-bar-tab-name-format-function' to let user specify a custom function to format the final string of tab name. This would be useful in many cases, for example, to add custom properties/faces to final tab name or to trim spaces in case 'tab-bar-rename-tab' has trailing spaces. It could also fix a trailing space when 'tab-bar-tab-hints' is set to true and 'tab-bar-tab-name-function' returns an empty string --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-tab-bar-tab-name-format-function.patch Content-Description: Add option to format tab-bar tab name diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 2604955224..82f3ca2385 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -334,6 +334,18 @@ tab-bar-tab-name-function :group 'tab-bar :version "27.1") +(defcustom tab-bar-tab-name-format-function nil + "Function to format a tab name. +Function get one argument, the tab name, and should return +the formatted tab name." + :type 'function + :initialize 'custom-initialize-default + :set (lambda (sym val) + (set-default sym val) + (force-mode-line-update)) + :group 'tab-bar + :version "28.1") + (defun tab-bar-tab-name-current () "Generate tab name from the buffer of the selected window." (buffer-name (window-buffer (minibuffer-selected-window)))) @@ -433,8 +445,9 @@ tab-bar-make-keymap-1 ((eq (car tab) 'current-tab) `((current-tab menu-item - ,(propertize (concat (if tab-bar-tab-hints (format "%d " i) "") - (alist-get 'name tab) + ,(propertize (concat (funcall (or tab-bar-tab-name-format-function 'identity) + (concat (if tab-bar-tab-hints (format "%d " i) "") + (alist-get 'name tab))) (or (and tab-bar-close-button-show (not (eq tab-bar-close-button-show 'non-selected)) @@ -445,8 +458,9 @@ tab-bar-make-keymap-1 (t `((,(intern (format "tab-%i" i)) menu-item - ,(propertize (concat (if tab-bar-tab-hints (format "%d " i) "") - (alist-get 'name tab) + ,(propertize (concat (funcall (or tab-bar-tab-name-format-function 'identity) + (concat (if tab-bar-tab-hints (format "%d " i) "") + (alist-get 'name tab))) (or (and tab-bar-close-button-show (not (eq tab-bar-close-button-show 'selected)) --=-=-= Content-Type: text/plain Regards, Gabriel do Nascimento Ribeiro --=-=-=--