emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: Ingo Lohmar <ingo.lohmar@posteo.net>
Cc: emacs-orgmode@gnu.org, Gustavo Barros <gusbrs.2016@gmail.com>
Subject: Re: Bug: org-link-descriptive needs to be buffer-local [9.4.4 (release_9.4.4 @ /usr/local/share/emacs/28.0.50/lisp/org/)]
Date: Wed, 07 Apr 2021 00:56:28 -0400	[thread overview]
Message-ID: <87im4ypu9v.fsf@kyleam.com> (raw)
In-Reply-To: <87lf9ve16c.fsf@kenko.localhost.com>

Ingo Lohmar writes:

> On Mon, Apr 05 2021 22:36 (-0400), Kyle Meyer wrote:

>> Hmm, I think a problem with `:local t' (or, equivalently,
>> make-variable-buffer-local for backward compatibility reasons) is that
>> then you'd interfere with user customization that directly sets this
>> after ol.el is loaded.  You could also still get into a mismatched state
>> like you described above if you load an Org buffer, set the value
>> through the customization interface, and then call
>> org-toggle-link-display in that buffer.
[...]
> I am not sure that I understand the problem you're describing..  Maybe
> it's because I don't use the customize interface myself, but I think any
> such customization would only set the default value, wouldn't it?

Yes.  Here are expanded descriptions for the two problems I'm referring
to above.  This is based on testing with the `:local t' diff below (on
top of bcfe6f985, before the commit I mentioned in my last message).

  * Breaks customization of direct setq callers if ol.el is already
    loaded.

    If

      (setq org-link-descriptive nil)

    is executed after ol.el is loaded, links in a visited Org buffer
    will be displayed according to the default org-link-descriptive
    value of t.

  * Setting org-link-descriptive via the customization interface can get
    into a mismatched state.

    - Visit an Org file with a link and description.
      org-link-descriptive is at its global value of t.

    - Set org-link-descriptive to nil via the customization interface,
      changing the global value to nil.  This value is in effect in the
      Org buffer because org-link-descriptive isn't yet buffer-local.
      The description is still hidden because buffer-invisibility-spec
      hasn't been changed.

    - Calling org-toggle-link-display sets org-link-descriptive to t,
      making org-link-descriptive a buffer-local variable.  The
      appearance of the description doesn't change due to the mismatch
      (like described in your original report).  Calling it again aligns
      the buffer-local value and buffer-invisibility-spec.

diff --git a/lisp/ol.el b/lisp/ol.el
index d1db1683b..0e225ce4e 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -193,6 +193,7 @@ (defcustom org-link-descriptive t
 `org-toggle-link-display' or from the \"Org > Hyperlinks\" menu."
   :group 'org-link
   :type 'boolean
+  :local t
   :safe #'booleanp)
 
 (defcustom org-link-make-description-function nil


      reply	other threads:[~2021-04-07  4:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01 19:15 Bug: org-link-descriptive needs to be buffer-local [9.4.4 (release_9.4.4 @ /usr/local/share/emacs/28.0.50/lisp/org/)] Ingo Lohmar
2021-04-06  2:36 ` Kyle Meyer
2021-04-06 18:08   ` Ingo Lohmar
2021-04-07  4:56     ` Kyle Meyer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87im4ypu9v.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=gusbrs.2016@gmail.com \
    --cc=ingo.lohmar@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).