From mboxrd@z Thu Jan 1 00:00:00 1970 From: D Subject: [PATCH] Re: org-hide-eading-stars-before-indent-mode Date: Wed, 19 Feb 2020 23:59:37 +0100 Message-ID: References: <9408b6f4-2180-98bd-92b7-415f739d99a4@posteo.net> <87v9o245k5.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------5CBCE201DBAD7A3726FAEC9E" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:41600) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j4YJi-0005IH-0b for emacs-orgmode@gnu.org; Wed, 19 Feb 2020 17:59:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j4YJg-0001z9-NB for emacs-orgmode@gnu.org; Wed, 19 Feb 2020 17:59:41 -0500 Received: from mout01.posteo.de ([185.67.36.65]:51823) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j4YJg-0001yk-3v for emacs-orgmode@gnu.org; Wed, 19 Feb 2020 17:59:40 -0500 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id E0BDB16005E for ; Wed, 19 Feb 2020 23:59:38 +0100 (CET) In-Reply-To: <87v9o245k5.fsf@gnu.org> Content-Language: en-US List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: Bastien , emacs-orgmode@gnu.org This is a multi-part message in MIME format. --------------5CBCE201DBAD7A3726FAEC9E Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Hi! On 19.02.20 22:42, Bastien wrote: > IIUC, it would be "and", not "or": first use > > (setq-local org-hide-leading-stars (default-value 'org-hide-leading-stars)) > > to set org-hide-leading-stars to a temporary value *and* > > (kill-local-variable 'org-hide-leading-stars) > > to restore the global value. Not quite, both are valid ways to revert hide-leading-stars to it's original value, with the second (which I picked for the patch) having the advantage to properly get rid off the buffer-local property again. The mode itself calls for setting the variable locally to `t' instead of the original value. I attached the patch, which I hope is the correct format. I'm still a bit new to this, my apologies if I cause any unnecessary work. Regards, D. --------------5CBCE201DBAD7A3726FAEC9E Content-Type: text/x-patch; charset=UTF-8; name="0001-org-indent.el-Deprecate-org-hide-leading-stars-befor.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-org-indent.el-Deprecate-org-hide-leading-stars-befor.pa"; filename*1="tch" >From d3390eb442bccef476fa2514d4078b9f8e9d978a Mon Sep 17 00:00:00 2001 From: "D. Williams" Date: Wed, 19 Feb 2020 23:50:48 +0100 Subject: [PATCH] org-indent.el: Deprecate `org-hide-leading-stars-before-indent-mode' * lisp/org-indent.el (org-indent-mode): Make `org-hide-leading-stars' buffer local and revert it back to it's global value when exiting the mode without storing it's global value manually. (org-hide-leading-stars-before-indent-mode): Remove declaration. This commit implements my suggestion from the mailing list (https://lists.gnu.org/archive/html/emacs-orgmode/2020-02/msg00759.html) to rely on Emacs' native mechanisms for restoring a buffer-local variable to it's global default value instead of storing the global value in a temporary variable (in this case: `org-hide-leading-stars-before-indent-mode'). TINYCHANGE --- lisp/org-indent.el | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lisp/org-indent.el b/lisp/org-indent.el index c136a75bd..73b077965 100644 --- a/lisp/org-indent.el +++ b/lisp/org-indent.el @@ -71,8 +71,6 @@ Delay used when the buffer to initialize isn't current.") (defvar org-indent--initial-marker nil "Position of initialization before interrupt. This is used locally in each buffer being initialized.") -(defvar org-hide-leading-stars-before-indent-mode nil - "Used locally.") (defvar org-indent-modified-headline-flag nil "Non-nil means the last deletion operated on a headline. It is modified by `org-indent-notify-modified-headline'.") @@ -183,8 +181,6 @@ during idle time." (or (eq org-adapt-indentation 'headline-data) (setq-local org-adapt-indentation nil))) (when org-indent-mode-turns-on-hiding-stars - (setq-local org-hide-leading-stars-before-indent-mode - org-hide-leading-stars) (setq-local org-hide-leading-stars t)) (org-indent--compute-prefixes) (if (boundp 'filter-buffer-substring-functions) @@ -216,9 +212,8 @@ during idle time." (delq (current-buffer) org-indent-agentized-buffers)) (when (markerp org-indent--initial-marker) (set-marker org-indent--initial-marker nil)) - (when (boundp 'org-hide-leading-stars-before-indent-mode) - (setq-local org-hide-leading-stars - org-hide-leading-stars-before-indent-mode)) + (when (local-variable-p 'org-hide-leading-stars) + (kill-local-variable 'org-hide-leading-stars)) (if (boundp 'filter-buffer-substring-functions) (remove-hook 'filter-buffer-substring-functions (lambda (fun start end delete) -- 2.24.1 --------------5CBCE201DBAD7A3726FAEC9E--