emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] link abbreviations do not work inside property drawers [9.5.2


From: Ignacio Casso
Subject: Re: [BUG] link abbreviations do not work inside property drawers [9.5.2 (release_9.5.2-38-g682ccd @ /home/ignacio/repos/emacs/lisp/org/)]
Date: Tue, 26 Apr 2022 11:07:44 +0200
User-agent: mu4e 1.6.10; emacs 27.2

Ihor Radchenko <yantar92@gmail.com> writes:

> Ignacio Casso <ignaciocasso@hotmail.com> writes:
>
>> So a simple solution to this would be preserving the value of
>> `org-link-abbrev-alist-local' when switching to the temporal buffer. I
>> think this is orthogonal to the issue of the parser, and it's a bug on
>> its own, since as a user I would expect that evaluating
>> `org-link-open-from-string' would use my current buffer's local values
>> of variables.
>
> I am not sure if using current buffer in `org-link-open-from-string' is
> to be expected. This function is not tied to buffer, just to string.
> Imagine a situation when user function retrieves the link string from
> another buffer and then calls `org-link-org-from-string' in the context
> of current buffer. What you are proposing is going to change the current
> behaviour of `org-link-open-from-string' beyond the discussed problem.
>
> Instead of changing the default behaviour of
> `org-link-open-from-string', I would introduce an optional parameter
> holding the desired context. The parameter can be set to an Org buffer.
> That buffer's context will be used.

I agree that changing the current behavior of
`org-link-open-from-string' may be problematic, however I don't think
that it's worth to introduce the optional argument just for this "bug".
I would just use the let from I suggested:

  (let ((org-link-abbrev-alist
         (append org-link-abbrev-alist org-link-abbrev-alist-local)))
    ...)

but instead of doing it in the definition of
`org-link-open-from-string', do it in `org-open-at-point-global',
like this:

(cond ((org-in-regexp org-link-any-re)
       (let ((org-link-abbrev-alist
              (append org-link-abbrev-alist org-link-abbrev-alist-local)))
         (org-link-open-from-string (match-string-no-properties 0))))
      ...)

or in `org-open-at-point', like this:

  (cond
   ...
   ((memq type '(comment comment-block node-property keyword))
    (let ((org-link-abbrev-alist
           (append org-link-abbrev-alist org-link-abbrev-alist-local)))
      (call-interactively #'org-open-at-point-global)))
   ...)

What do you think?

--Ignacio



reply via email to

[Prev in Thread] Current Thread [Next in Thread]