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 <ywwry66@gmail.com>
Link: https://orgmode.org/list/F3A95086-B4BF-4C08-AF7A-8D7DE6FE30CF@gmail.com
This commit is contained in:
Ihor Radchenko 2024-02-23 16:21:13 +03:00
parent 24ce9abce7
commit 256caa0823
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
2 changed files with 4 additions and 4 deletions

View File

@ -116,6 +116,7 @@ than its value."
(const :tag "No limit" nil) (const :tag "No limit" nil)
(integer :tag "Maximum level"))) (integer :tag "Maximum level")))
(defvaralias 'org-hide-block-startup 'org-cycle-hide-block-startup)
(defcustom org-cycle-hide-block-startup nil (defcustom org-cycle-hide-block-startup nil
"Non-nil means entering Org mode will fold all blocks. "Non-nil means entering Org mode will fold all blocks.
This can also be set in on a per-file basis with This can also be set in on a per-file basis with
@ -126,6 +127,7 @@ This can also be set in on a per-file basis with
:group 'org-cycle :group 'org-cycle
:type 'boolean) :type 'boolean)
(defvaralias 'org-hide-drawer-startup 'org-cycle-hide-drawer-startup)
(defcustom org-cycle-hide-drawer-startup t (defcustom org-cycle-hide-drawer-startup t
"Non-nil means entering Org mode will fold all drawers. "Non-nil means entering Org mode will fold all drawers.
This can also be set in on a per-file basis with This can also be set in on a per-file basis with
@ -201,6 +203,7 @@ Special case: when 0, never leave empty lines in collapsed view."
:type 'integer) :type 'integer)
(put 'org-cycle-separator-lines 'safe-local-variable 'integerp) (put 'org-cycle-separator-lines 'safe-local-variable 'integerp)
(defvaralias 'org-pre-cycle-hook 'org-cycle-pre-hook)
(defcustom org-cycle-pre-hook nil (defcustom org-cycle-pre-hook nil
"Hook that is run before visibility cycling is happening. "Hook that is run before visibility cycling is happening.
The function(s) in this hook must accept a single argument which indicates The function(s) in this hook must accept a single argument which indicates
@ -241,6 +244,7 @@ normal outline commands like `show-all', but not with the cycling commands."
:package-version '(Org . "9.6") :package-version '(Org . "9.6")
:type 'boolean) :type 'boolean)
(defvaralias 'org-tab-first-hook 'org-cycle-tab-first-hook)
(defvar org-cycle-tab-first-hook nil (defvar org-cycle-tab-first-hook nil
"Hook for functions to attach themselves to TAB. "Hook for functions to attach themselves to TAB.
See `org-ctrl-c-ctrl-c-hook' for more information. See `org-ctrl-c-ctrl-c-hook' for more information.

View File

@ -101,10 +101,6 @@
(require 'org-fold) (require 'org-fold)
(require 'org-cycle) (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-global-cycle #'org-cycle-global)
(defalias 'org-overview #'org-cycle-overview) (defalias 'org-overview #'org-cycle-overview)
(defalias 'org-content #'org-cycle-content) (defalias 'org-content #'org-cycle-content)