From bfe253f7eb19bf2b1bacf7dffb4a06355b71aafa Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Fri, 23 Feb 2024 16:21:13 +0300 Subject: [PATCH] org-cycle: Fix "Overwriting value of ... by aliasing" warning * lisp/org-cycle.el: * lisp/org.el (org-cycle): Move variable aliases right before new variable name definitions in org-cycle.el. Otherwise, if users set the aliased variable values before loading Org-mode, they might get overwritten by the default value. Reported-by: Ruiyang Wu Link: https://orgmode.org/list/F3A95086-B4BF-4C08-AF7A-8D7DE6FE30CF@gmail.com --- lisp/org-cycle.el | 4 ++++ lisp/org.el | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/org-cycle.el b/lisp/org-cycle.el index 53e086552..49f0d2af6 100644 --- a/lisp/org-cycle.el +++ b/lisp/org-cycle.el @@ -115,6 +115,7 @@ than its value." (const :tag "No limit" nil) (integer :tag "Maximum level"))) +(defvaralias 'org-hide-block-startup 'org-cycle-hide-block-startup) (defcustom org-cycle-hide-block-startup nil "Non-nil means entering Org mode will fold all blocks. This can also be set in on a per-file basis with @@ -125,6 +126,7 @@ This can also be set in on a per-file basis with :group 'org-cycle :type 'boolean) +(defvaralias 'org-hide-drawer-startup 'org-cycle-hide-drawer-startup) (defcustom org-cycle-hide-drawer-startup t "Non-nil means entering Org mode will fold all drawers. This can also be set in on a per-file basis with @@ -200,6 +202,7 @@ Special case: when 0, never leave empty lines in collapsed view." :type 'integer) (put 'org-cycle-separator-lines 'safe-local-variable 'integerp) +(defvaralias 'org-pre-cycle-hook 'org-cycle-pre-hook) (defcustom org-cycle-pre-hook nil "Hook that is run before visibility cycling is happening. The function(s) in this hook must accept a single argument which indicates @@ -240,6 +243,7 @@ normal outline commands like `show-all', but not with the cycling commands." :package-version '(Org . "9.6") :type 'boolean) +(defvaralias 'org-tab-first-hook 'org-cycle-tab-first-hook) (defvar org-cycle-tab-first-hook nil "Hook for functions to attach themselves to TAB. See `org-ctrl-c-ctrl-c-hook' for more information. diff --git a/lisp/org.el b/lisp/org.el index 0fd5b2762..62b1ffb07 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -101,10 +101,6 @@ (require 'org-fold) (require 'org-cycle) -(defvaralias 'org-hide-block-startup 'org-cycle-hide-block-startup) -(defvaralias 'org-hide-drawer-startup 'org-cycle-hide-drawer-startup) -(defvaralias 'org-pre-cycle-hook 'org-cycle-pre-hook) -(defvaralias 'org-tab-first-hook 'org-cycle-tab-first-hook) (defalias 'org-global-cycle #'org-cycle-global) (defalias 'org-overview #'org-cycle-overview) (defalias 'org-content #'org-cycle-content)