all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [BUG] When calling org-tree-to-indirect-buffer: (wrong-type-argument listp org-fold-outline) in org-fold-core-get-folding-spec-from-alias [9.6.6 (release_9.6.6 @ /gnu/store/c7vqk20kf6zw73klr8bacnh0gqahk5dd-emacs-29.1-29.1/share/emacs/29.1/lisp/org/)]
@ 2023-08-24 16:50 Adam Porter
  2023-08-25  8:19 ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Adam Porter @ 2023-08-24 16:50 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 721 bytes --]

Hi,

Since upgrading to Emacs 29.1 and Org 9.6.6, I am getting an error when
opening a bookmark to an Org subtree buffer created with burly.el.  When
opening the bookmark, burly calls org-tree-to-indirect-buffer to make a
new indirect buffer showing the subtree in question.  This worked fine
in Emacs 28 and the previous Org version I was using, 9.5.something,
IIRC.  Now I get this error (please see the attached backtrace, which is 
abbreviated, and some functions were re-evaluated so as to be interpreted).

FWIW, I also tried setting org-fold-core-style to overlays and
restarting Emacs, but the error still happens, although with a different
symbol in place of org-fold-outline.

Thanks for your work on Org.

Adam

[-- Attachment #2: backtrace.txt --]
[-- Type: text/plain, Size: 8196 bytes --]

Debugger entered--Lisp error: (wrong-type-argument listp org-fold-outline)
  car(org-fold-outline)
  alist-get(org-fold-outline ((:alias . org-link) (org-link . org-link) (:alias . org-link-description) (org-link-description . org-link-description) (property-drawer . org-fold-drawer) (drawer . org-fold-drawer) (:alias . org-fold-drawer) (org-fold-drawer . org-fold-drawer) (verse-block . org-fold-block) (src-block . org-fold-block) (special-block . org-fold-block) (quote-block . org-fold-block) (export-block . org-fold-block) (example-block . org-fold-block) (dynamic-block . org-fold-block) (comment-block . org-fold-block) (center-block . org-fold-block) (block . org-fold-block) (:alias . org-fold-block) (org-fold-block . org-fold-block) (plain-list . org-fold-outline) (inlinetask . org-fold-outline) (outline . org-fold-outline) (heading . org-fold-outline) (headline . org-fold-outline) (:alias . org-fold-outline) (org-fold-outline . org-fold-outline)))
  org-fold-core-get-folding-spec-from-alias(org-fold-outline)
  org-fold-core--property-symbol-get-create(org-fold-outline)
  org-fold-core-decouple-indirect-buffer-folds()
  org-get-indirect-buffer(#<buffer USHIN.org> #("Meetings / Sessions" 0 19 (fontified nil line-prefix "" wrap-prefix #("* " 0 2 (face org-indent)))))
  #<subr org-tree-to-indirect-buffer>()
  apply(#<subr org-tree-to-indirect-buffer> nil)
  org-tree-to-indirect-buffer()
  (cond (indirect (org-tree-to-indirect-buffer)) (narrowed (progn (org-narrow-to-subtree) (goto-char (org-find-olp (read point-olp) 'this-buffer)))))
  (progn (widen) (if heading-pos (goto-char heading-pos) (goto-char (string-to-number pos))) (cond (indirect (org-tree-to-indirect-buffer)) (narrowed (progn (org-narrow-to-subtree) (goto-char (org-find-olp (read point-olp) 'this-buffer))))) (if (and heading-pos relative-pos) (progn (forward-char (string-to-number relative-pos)))) (current-buffer))
  (let* ((heading-pos (if top-olp (progn (org-find-olp (read top-olp) 'this-buffer))))) (progn (widen) (if heading-pos (goto-char heading-pos) (goto-char (string-to-number pos))) (cond (indirect (org-tree-to-indirect-buffer)) (narrowed (progn (org-narrow-to-subtree) (goto-char (org-find-olp (read point-olp) 'this-buffer))))) (if (and heading-pos relative-pos) (progn (forward-char (string-to-number relative-pos)))) (current-buffer)))
  (let ((pos x2699) (indirect x2700) (narrowed x2701) (top-olp x2702) (point-olp x2703) (relative-pos x2704)) (let* ((heading-pos (if top-olp (progn (org-find-olp (read top-olp) 'this-buffer))))) (progn (widen) (if heading-pos (goto-char heading-pos) (goto-char (string-to-number pos))) (cond (indirect (org-tree-to-indirect-buffer)) (narrowed (progn (org-narrow-to-subtree) (goto-char (org-find-olp ... ...))))) (if (and heading-pos relative-pos) (progn (forward-char (string-to-number relative-pos)))) (current-buffer))))
  (let* ((x2699 (map-elt query "pos")) (x2700 (map-elt query "indirect")) (x2701 (map-elt query "narrowed")) (x2702 (map-elt query "top-olp")) (x2703 (map-elt query "point-olp")) (x2704 (map-elt query "relative-pos"))) (let ((pos x2699) (indirect x2700) (narrowed x2701) (top-olp x2702) (point-olp x2703) (relative-pos x2704)) (let* ((heading-pos (if top-olp (progn (org-find-olp ... ...))))) (progn (widen) (if heading-pos (goto-char heading-pos) (goto-char (string-to-number pos))) (cond (indirect (org-tree-to-indirect-buffer)) (narrowed (progn (org-narrow-to-subtree) (goto-char ...)))) (if (and heading-pos relative-pos) (progn (forward-char (string-to-number relative-pos)))) (current-buffer)))))
  (progn (ignore (mapp query)) (let* ((x2699 (map-elt query "pos")) (x2700 (map-elt query "indirect")) (x2701 (map-elt query "narrowed")) (x2702 (map-elt query "top-olp")) (x2703 (map-elt query "point-olp")) (x2704 (map-elt query "relative-pos"))) (let ((pos x2699) (indirect x2700) (narrowed x2701) (top-olp x2702) (point-olp x2703) (relative-pos x2704)) (let* ((heading-pos (if top-olp (progn ...)))) (progn (widen) (if heading-pos (goto-char heading-pos) (goto-char (string-to-number pos))) (cond (indirect (org-tree-to-indirect-buffer)) (narrowed (progn ... ...))) (if (and heading-pos relative-pos) (progn (forward-char ...))) (current-buffer))))))
  (progn (fset 'alist-get vnew) (progn (ignore (mapp query)) (let* ((x2699 (map-elt query "pos")) (x2700 (map-elt query "indirect")) (x2701 (map-elt query "narrowed")) (x2702 (map-elt query "top-olp")) (x2703 (map-elt query "point-olp")) (x2704 (map-elt query "relative-pos"))) (let ((pos x2699) (indirect x2700) (narrowed x2701) (top-olp x2702) (point-olp x2703) (relative-pos x2704)) (let* ((heading-pos (if top-olp ...))) (progn (widen) (if heading-pos (goto-char heading-pos) (goto-char ...)) (cond (indirect ...) (narrowed ...)) (if (and heading-pos relative-pos) (progn ...)) (current-buffer)))))))
  (unwind-protect (progn (fset 'alist-get vnew) (progn (ignore (mapp query)) (let* ((x2699 (map-elt query "pos")) (x2700 (map-elt query "indirect")) (x2701 (map-elt query "narrowed")) (x2702 (map-elt query "top-olp")) (x2703 (map-elt query "point-olp")) (x2704 (map-elt query "relative-pos"))) (let ((pos x2699) (indirect x2700) (narrowed x2701) (top-olp x2702) (point-olp x2703) (relative-pos x2704)) (let* ((heading-pos ...)) (progn (widen) (if heading-pos ... ...) (cond ... ...) (if ... ...) (current-buffer))))))) (fset 'alist-get old))
  (let* ((vnew #'(lambda (key alist &optional _default _remove _testfn) (car (cdr (assoc-string key alist))))) (old (symbol-function 'alist-get))) (unwind-protect (progn (fset 'alist-get vnew) (progn (ignore (mapp query)) (let* ((x2699 (map-elt query "pos")) (x2700 (map-elt query "indirect")) (x2701 (map-elt query "narrowed")) (x2702 (map-elt query "top-olp")) (x2703 (map-elt query "point-olp")) (x2704 (map-elt query "relative-pos"))) (let ((pos x2699) (indirect x2700) (narrowed x2701) (top-olp x2702) (point-olp x2703) (relative-pos x2704)) (let* (...) (progn ... ... ... ... ...)))))) (fset 'alist-get old)))
  (save-current-buffer (set-buffer buffer) (let* ((vnew #'(lambda (key alist &optional _default _remove _testfn) (car (cdr ...)))) (old (symbol-function 'alist-get))) (unwind-protect (progn (fset 'alist-get vnew) (progn (ignore (mapp query)) (let* ((x2699 ...) (x2700 ...) (x2701 ...) (x2702 ...) (x2703 ...) (x2704 ...)) (let (... ... ... ... ... ...) (let* ... ...))))) (fset 'alist-get old))))
  (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) '(:buffer :query :allow-other-keys)) (if (cdr --cl-keys--) nil (error "Missing argument for %s" (car --cl-keys--))) (setq --cl-keys-- (cdr (cdr --cl-keys--)))) ((car (cdr (memq ... --cl-rest--))) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:buffer :query)" (car --cl-keys--)))))) (save-current-buffer (set-buffer buffer) (let* ((vnew #'(lambda (key alist &optional _default _remove _testfn) (car ...))) (old (symbol-function 'alist-get))) (unwind-protect (progn (fset 'alist-get vnew) (progn (ignore (mapp query)) (let* (... ... ... ... ... ...) (let ... ...)))) (fset 'alist-get old)))))
  (let* ((buffer (car (cdr (plist-member --cl-rest-- ':buffer)))) (query (car (cdr (plist-member --cl-rest-- ':query))))) (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) '...) (if (cdr --cl-keys--) nil (error "Missing argument for %s" ...)) (setq --cl-keys-- (cdr ...))) ((car (cdr ...)) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:buffer :query)" (car --cl-keys--)))))) (save-current-buffer (set-buffer buffer) (let* ((vnew #'(lambda ... ...)) (old (symbol-function 'alist-get))) (unwind-protect (progn (fset 'alist-get vnew) (progn (ignore ...) (let* ... ...))) (fset 'alist-get old))))))
  burly-follow-url-org-mode(:buffer #<buffer USHIN.org> :query (("narrowed" "t") ("indirect" "t") ("relative-pos" "0") ("point-olp" "(\"Meetings / Sessions\")") ("top-olp" "(\"Meetings / Sessions\")") ("pos" "35523")))
  funcall(burly-follow-url-org-mode :buffer #<buffer USHIN.org> :query (("narrowed" "t") ("indirect" "t") ("relative-pos" "0") ("point-olp" "(\"Meetings / Sessions\")") ("top-olp" "(\"Meetings / Sessions\")") ("pos" "35523")))

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] When calling org-tree-to-indirect-buffer: (wrong-type-argument listp org-fold-outline) in org-fold-core-get-folding-spec-from-alias [9.6.6 (release_9.6.6 @ /gnu/store/c7vqk20kf6zw73klr8bacnh0gqahk5dd-emacs-29.1-29.1/share/emacs/29.1/lisp/org/)]
  2023-08-24 16:50 [BUG] When calling org-tree-to-indirect-buffer: (wrong-type-argument listp org-fold-outline) in org-fold-core-get-folding-spec-from-alias [9.6.6 (release_9.6.6 @ /gnu/store/c7vqk20kf6zw73klr8bacnh0gqahk5dd-emacs-29.1-29.1/share/emacs/29.1/lisp/org/)] Adam Porter
@ 2023-08-25  8:19 ` Ihor Radchenko
  2023-08-28  6:35   ` Adam Porter
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2023-08-25  8:19 UTC (permalink / raw)
  To: Adam Porter; +Cc: emacs-orgmode

Adam Porter <adam@alphapapa.net> writes:

> Since upgrading to Emacs 29.1 and Org 9.6.6, I am getting an error when
> opening a bookmark to an Org subtree buffer created with burly.el.  When
> opening the bookmark, burly calls org-tree-to-indirect-buffer to make a
> new indirect buffer showing the subtree in question.  This worked fine
> in Emacs 28 and the previous Org version I was using, 9.5.something,
> IIRC.  Now I get this error (please see the attached backtrace, which is 
> abbreviated, and some functions were re-evaluated so as to be interpreted).

Thanks for reporting!

> Debugger entered--Lisp error: (wrong-type-argument listp org-fold-outline)
>   car(org-fold-outline)
>   alist-get(org-fold-outline ((:alias . org-link) (org-link . org-link) (:alias . org-link-description) (org-link-description . org-link-description) (property-drawer . org-fold-drawer) (drawer . org-fold-drawer) (:alias . org-fold-drawer) (org-fold-drawer . org-fold-drawer) (verse-block . org-fold-block) (src-block . org-fold-block) (special-block . org-fold-block) (quote-block . org-fold-block) (export-block . org-fold-block) (example-block . org-fold-block) (dynamic-block . org-fold-block) (comment-block . org-fold-block) (center-block . org-fold-block) (block . org-fold-block) (:alias . org-fold-block) (org-fold-block . org-fold-block) (plain-list . org-fold-outline) (inlinetask . org-fold-outline) (outline . org-fold-outline) (heading . org-fold-outline) (headline . org-fold-outline) (:alias . org-fold-outline) (org-fold-outline . org-fold-outline)))
>   org-fold-core-get-folding-spec-from-alias(org-fold-outline)
>   org-fold-core--property-symbol-get-create(org-fold-outline)

This is a very strange backtrace.
When I run that `alist-get' call manually, there is no error. And
`alist-get' does not call `car'.

May you try to re-generate the backtrace again?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] When calling org-tree-to-indirect-buffer: (wrong-type-argument listp org-fold-outline) in org-fold-core-get-folding-spec-from-alias [9.6.6 (release_9.6.6 @ /gnu/store/c7vqk20kf6zw73klr8bacnh0gqahk5dd-emacs-29.1-29.1/share/emacs/29.1/lisp/org/)]
  2023-08-25  8:19 ` Ihor Radchenko
@ 2023-08-28  6:35   ` Adam Porter
  2023-08-28  9:24     ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Adam Porter @ 2023-08-28  6:35 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Hi Ihor,

On 8/25/23 03:19, Ihor Radchenko wrote:

>> Debugger entered--Lisp error: (wrong-type-argument listp org-fold-outline)
>>    car(org-fold-outline)
>>    alist-get(org-fold-outline ((:alias . org-link) (org-link . org-link) (:alias . org-link-description) (org-link-description . org-link-description) (property-drawer . org-fold-drawer) (drawer . org-fold-drawer) (:alias . org-fold-drawer) (org-fold-drawer . org-fold-drawer) (verse-block . org-fold-block) (src-block . org-fold-block) (special-block . org-fold-block) (quote-block . org-fold-block) (export-block . org-fold-block) (example-block . org-fold-block) (dynamic-block . org-fold-block) (comment-block . org-fold-block) (center-block . org-fold-block) (block . org-fold-block) (:alias . org-fold-block) (org-fold-block . org-fold-block) (plain-list . org-fold-outline) (inlinetask . org-fold-outline) (outline . org-fold-outline) (heading . org-fold-outline) (headline . org-fold-outline) (:alias . org-fold-outline) (org-fold-outline . org-fold-outline)))
>>    org-fold-core-get-folding-spec-from-alias(org-fold-outline)
>>    org-fold-core--property-symbol-get-create(org-fold-outline)
> 
> This is a very strange backtrace.
> When I run that `alist-get' call manually, there is no error. And
> `alist-get' does not call `car'.
> 
> May you try to re-generate the backtrace again?

It is indeed strange.  I generated the backtrace several times over 
several sessions before reporting.  I also can reproduce it in a clean 
Emacs configuration like so:

Using with-emacs.sh on Emacs 29.1:

1.  Run "with-emacs.sh -i burly"
2.  "C-x C-f /tmp/test.org RET"
3.  Input a file like so:

   * Heading A
   ** Heading A1

4.  With point on Heading A1, "C-c C-x b".
5.  "M-x delete-other-windows RET" to show only the subtree buffer.
6.  "M-x burly-bookmark-windows RET", input name, save bookmark.
7.  Kill the file's buffer and delete-other-windows.
8.  "C-x r b" select bookmark that was created, and open it.
9.  You should get the error, and with debug-on-error, the backtrace.

This bug breaks burly's functionality to bookmark and restore subtree 
buffers, which worked fine before upgrading to Emacs 29.1.

Thanks,
Adam


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] When calling org-tree-to-indirect-buffer: (wrong-type-argument listp org-fold-outline) in org-fold-core-get-folding-spec-from-alias [9.6.6 (release_9.6.6 @ /gnu/store/c7vqk20kf6zw73klr8bacnh0gqahk5dd-emacs-29.1-29.1/share/emacs/29.1/lisp/org/)]
  2023-08-28  6:35   ` Adam Porter
@ 2023-08-28  9:24     ` Ihor Radchenko
  2023-08-31  4:22       ` Adam Porter
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2023-08-28  9:24 UTC (permalink / raw)
  To: Adam Porter; +Cc: emacs-orgmode

Adam Porter <adam@alphapapa.net> writes:

>> This is a very strange backtrace.
>> When I run that `alist-get' call manually, there is no error. And
>> `alist-get' does not call `car'.
>> 
>> May you try to re-generate the backtrace again?
>
> It is indeed strange.  I generated the backtrace several times over 
> several sessions before reporting.  I also can reproduce it in a clean 
> Emacs configuration like so:

You re-define `alist-get' in one of the callers in a way that cannot
handle normal alists like (key . value), not (key . list-value).

(cl-defun burly-follow-url-org-mode (&key buffer query)
  "In BUFFER, jump to heading and position from QUERY, and return a buffer.
If QUERY specifies that the buffer should be indirect, a new,
indirect buffer is returned.  Otherwise BUFFER is returned."
  ;; `pcase's map support uses `alist-get', which does not work with string keys
  ;; unless its TESTFN arg is bound to, e.g. `equal', but `map-elt' has deprecated
  ;; its TESTFN arg, and there's no way to pass it or bind it when using `pcase'
  ;; anyway.  So we rebind `alist-get' to a function that uses `assoc-string'.
  (with-current-buffer buffer
    (cl-letf (((symbol-function 'alist-get)
               (lambda (key alist &optional _default _remove _testfn)
                 ;; Only the first value in the list of values is returned, so multiple
                 ;; values are not supported.  I don't expect this to be a problem...
                 (cadr (assoc-string key alist)))))

Handled.
Not an Org bug.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] When calling org-tree-to-indirect-buffer: (wrong-type-argument listp org-fold-outline) in org-fold-core-get-folding-spec-from-alias [9.6.6 (release_9.6.6 @ /gnu/store/c7vqk20kf6zw73klr8bacnh0gqahk5dd-emacs-29.1-29.1/share/emacs/29.1/lisp/org/)]
  2023-08-28  9:24     ` Ihor Radchenko
@ 2023-08-31  4:22       ` Adam Porter
  0 siblings, 0 replies; 5+ messages in thread
From: Adam Porter @ 2023-08-31  4:22 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Hi Ihor,

On 8/28/23 04:24, Ihor Radchenko wrote:
> Adam Porter <adam@alphapapa.net> writes:
> 
>>> This is a very strange backtrace.
>>> When I run that `alist-get' call manually, there is no error. And
>>> `alist-get' does not call `car'.
>>>
>>> May you try to re-generate the backtrace again?
>>
>> It is indeed strange.  I generated the backtrace several times over
>> several sessions before reporting.  I also can reproduce it in a clean
>> Emacs configuration like so:
> 
> You re-define `alist-get' in one of the callers in a way that cannot
> handle normal alists like (key . value), not (key . list-value).
> 
> (cl-defun burly-follow-url-org-mode (&key buffer query)
>    "In BUFFER, jump to heading and position from QUERY, and return a buffer.
> If QUERY specifies that the buffer should be indirect, a new,
> indirect buffer is returned.  Otherwise BUFFER is returned."
>    ;; `pcase's map support uses `alist-get', which does not work with string keys
>    ;; unless its TESTFN arg is bound to, e.g. `equal', but `map-elt' has deprecated
>    ;; its TESTFN arg, and there's no way to pass it or bind it when using `pcase'
>    ;; anyway.  So we rebind `alist-get' to a function that uses `assoc-string'.
>    (with-current-buffer buffer
>      (cl-letf (((symbol-function 'alist-get)
>                 (lambda (key alist &optional _default _remove _testfn)
>                   ;; Only the first value in the list of values is returned, so multiple
>                   ;; values are not supported.  I don't expect this to be a problem...
>                   (cadr (assoc-string key alist)))))
> 
> Handled.
> Not an Org bug.

My apologies, I overlooked that when investigating the problem.  Thanks 
for your work.

Adam


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-08-31  4:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-24 16:50 [BUG] When calling org-tree-to-indirect-buffer: (wrong-type-argument listp org-fold-outline) in org-fold-core-get-folding-spec-from-alias [9.6.6 (release_9.6.6 @ /gnu/store/c7vqk20kf6zw73klr8bacnh0gqahk5dd-emacs-29.1-29.1/share/emacs/29.1/lisp/org/)] Adam Porter
2023-08-25  8:19 ` Ihor Radchenko
2023-08-28  6:35   ` Adam Porter
2023-08-28  9:24     ` Ihor Radchenko
2023-08-31  4:22       ` Adam Porter

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.