* [BUG] Confirmation message for elisp links is badly formatted [9.5.2 (9.5.2-gfbff08 @ /home/omarantolin/.emacs.d/elpa/org-9.5.2/)]
@ 2022-01-30 16:01 Omar Antolín Camarena
2022-01-31 11:38 ` Timothy
0 siblings, 1 reply; 6+ messages in thread
From: Omar Antolín Camarena @ 2022-01-30 16:01 UTC (permalink / raw)
To: emacs-orgmode
Remember to cover the basics, that is, what you expected to happen and
what in fact did happen. You don't know how to make a good report? See
https://orgmode.org/manual/Feedback.html#Feedback
Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------
By default Org prompts you to make sure you really want to execute the code in an elisp link; as the docstring for org-link-elisp-confirm-function says, just think about a link like [[elisp:(shell-command "rm -rf ~/*")][Web Search]]!
But the formatting of the default confirmation message leaves something to be desired. The function org-link--open-elisp which is in charge of confirming that you want to execute the code does this:
#+begin_src emacs-lisp
(funcall org-link-elisp-confirm-function
(format "Execute %S as Elisp? "
(org-add-props path nil 'face 'org-warning)))
#+end_src emacs-lisp
And the combination of capital %S with the propertized path produces confirmation prompts like the following:
Execute #("(describe-variable 'org-capture-templates)" 0 42 (face org-warning)) as Elisp?
Notice that instead of /being/ propertized with the org-warning face it shows a textual representation of the propertize string!
I'd suggest fixing this by /not/ propertizing the link target.
Emacs : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0)
of 2021-04-04, unofficial emacs-snapshot build: http://emacs.ganneff.de/, git commit dd5ba88afbb63f54603cc632fc55993c04531a85
Package: Org mode version 9.5.2 (9.5.2-gfbff08 @ /home/omarantolin/.emacs.d/elpa/org-9.5.2/)
current state:
==============
(setq
org-link-elisp-confirm-function 'y-or-n-p
org-directory "~/Notes"
org-hide-emphasis-markers t
org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"]
org-agenda-files '("~/Notes/Refile.org" "~/Notes/Daily.org"
"~/Notes/Work.org" "~/Notes/Someday.org")
org-capture-templates '(("s" "Someday" entry (file "Someday.org") "* %?\n")
("d" "Daily" entry (file+olp+datetree "Daily.org")
"* TODO %?\n")
("r" "Refile" entry (file "Refile.org") "* %?\n")
("j" "Journal entry" plain
(file+olp+datetree "Journal.org"))
("e" "Emacs templates")
("ei" "Idea" entry
(file+olp "Editors/Emacs.org" "Ideas") "* %?\n")
("et" "Tip" entry
(file+olp "Editors/Emacs.org" "Tips") "* %?\n")
("eq" "Question" entry
(file+olp "Editors/Emacs.org" "Questions") "* %?\n")
("ep" "Package" entry
(file+olp "Editors/Emacs.org" "Packages") "* %?\n")
)
org-refile-targets '((nil :maxlevel . 2) ("~/Notes/Notes.org" :maxlevel . 2)
("~/Notes/Someday.org" :level . 0)
("~/Notes/Daily.org" :level . 3)
("~/Notes/Work.org" :maxlevel . 2)
("~/Notes/Math.org" :maxlevel . 2))
org-export-before-parsing-hook '(org-attach-expand-links)
org-refile-use-outline-path 'file
org-archive-hook '(org-attach-archive-delete-maybe)
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
org-link-from-user-regexp "\\<omarantolin@penguin\\>\\|\\<omarantolin\\>"
org-mode-hook '(#[0 "\300\301\302\303\304$\207"
[add-hook change-major-mode-hook org-show-all append local]
5]
#[0 "\300\301\302\303\304$\207"
[add-hook change-major-mode-hook org-babel-show-result-all
append local]
5]
org-babel-result-hide-spec org-babel-hide-all-hashes
#[0 "\301\211\207"
[imenu-create-index-function org-imenu-get-tree] 2]
add-pretty-entities-hook org-tweak-syntax-table
turn-off-visual-line-mode turn-on-auto-fill
echo-area-tooltips ediff-with-org-show-all
turn-on-org-cdlatex beginend-org-mode)
outline-mode-hook '(beginend-outline-mode)
org-ellipsis "…"
org-confirm-shell-link-function 'yes-or-no-p
org-reveal-start-hook '(org-decrypt-entry)
outline-isearch-open-invisible-function 'outline-isearch-open-invisible
org-highlight-latex-and-related '(latex script entities)
org-agenda-mode-hook '(beginend-org-agenda-mode)
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-latex-packages-alist '(("AUTO" "babel" t ("pdflatex")))
org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
org-confirm-elisp-link-function 'y-or-n-p
org-hide-leading-stars t
org-todo-keywords '((sequence "TODO" "|" "DONE" "NOPE") (type "WAIT"))
org-structure-template-alist '(("a" . "export ascii") ("c" . "center")
("C" . "comment") ("e" . "example")
("E" . "export") ("h" . "export html")
("l" . "export latex") ("q" . "quote")
("s" . "src") ("v" . "verse")
("thm" . "theorem") ("pf" . "proof")
("lem" . "lemma") ("cor" . "corollary")
("def" . "definition") ("rem" . "remark")
("exer" . "exercise") ("prop" . "proposition")
("el" . "src emacs-lisp"))
org-pretty-entities t
org-preview-latex-image-directory "~/.cache/ltximg/"
org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
org-confirm-babel-evaluate nil
org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
org-link-shell-confirm-function 'yes-or-no-p
org-babel-pre-tangle-hook '(save-buffer)
org-agenda-loop-over-headlines-in-active-region nil
org-occur-hook '(org-first-headline-recenter)
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-link-parameters '(("attachment" :follow org-attach-follow :complete
org-attach-complete-link)
("id" :follow org-id-open)
("eww" :follow org-eww-open :store org-eww-store-link)
("rmail" :follow org-rmail-open :store
org-rmail-store-link)
("mhe" :follow org-mhe-open :store org-mhe-store-link)
("irc" :follow org-irc-visit :store org-irc-store-link
:export org-irc-export)
("info" :follow org-info-open :export org-info-export
:store org-info-store-link)
("docview" :follow org-docview-open :export
org-docview-export :store org-docview-store-link)
("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
("bbdb" :follow org-bbdb-open :export org-bbdb-export
:complete org-bbdb-complete-link :store
org-bbdb-store-link)
("w3m" :store org-w3m-store-link)
("doi" :export org-link-doi-export :follow
org-link-doi-open)
("arXiv" :face org-link :follow
#[some ugly bytecode with null characters in it])
("https" :follow
#[some ugly bytecode with null characters in it])
("ftp" :follow
#[some ugly bytecode with null characters in it])
("help" :follow org-link--open-help :store
org-link--store-help)
("file" :complete org-link-complete-file)
("elisp" :follow org-link--open-elisp))
org-metaup-hook '(org-babel-load-in-session-maybe)
org-refile-allow-creating-parent-nodes 'confirm
org-outline-path-complete-in-steps nil
org-special-ctrl-a/e t
org-tags-column -55
org-src-lang-modes '(("latex-macros" . latex) ("inline-js" . javascript)
("C" . c) ("C++" . c++) ("asymptote" . asy)
("bash" . sh) ("beamer" . latex) ("calc" . fundamental)
("cpp" . c++) ("ditaa" . artist) ("dot" . fundamental)
("elisp" . emacs-lisp) ("ocaml" . tuareg)
("screen" . shell-script) ("shell" . sh)
("sqlite" . sql))
)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BUG] Confirmation message for elisp links is badly formatted [9.5.2 (9.5.2-gfbff08 @ /home/omarantolin/.emacs.d/elpa/org-9.5.2/)]
2022-01-30 16:01 [BUG] Confirmation message for elisp links is badly formatted [9.5.2 (9.5.2-gfbff08 @ /home/omarantolin/.emacs.d/elpa/org-9.5.2/)] Omar Antolín Camarena
@ 2022-01-31 11:38 ` Timothy
2022-02-01 1:06 ` Omar Antolín Camarena
2022-02-01 11:35 ` Max Nikulin
0 siblings, 2 replies; 6+ messages in thread
From: Timothy @ 2022-01-31 11:38 UTC (permalink / raw)
To: Omar Antolín Camarena; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1266 bytes --]
Hi Omar,
Thanks for the report, I’ve fixed this in b3ceafd0 :)
Omar Antolín Camarena <omar@matem.unam.mx> writes:
> By default Org prompts you to make sure you really want to execute the code in
> an elisp link; as the docstring for org-link-elisp-confirm-function says, just
> think about a link like [Web Search]!
>
> But the formatting of the default confirmation message leaves something to be
> desired. The function org-link–open-elisp which is in charge of confirming that
> you want to execute the code does this:
>
> #+begin_src emacs-lisp
> (funcall org-link-elisp-confirm-function
> (format “Execute %S as Elisp? ”
> (org-add-props path nil ’face ’org-warning)))
> #+end_src emacs-lisp
>
> And the combination of capital %S with the propertized path produces confirmation prompts like the following:
>
> Execute #(“(describe-variable ‘org-capture-templates)” 0 42 (face org-warning)) as Elisp?
>
> Notice that instead of /being/ propertized with the org-warning face it shows a textual representation of the propertize string!
>
> I’d suggest fixing this by /not/ propertizing the link target.
All the best,
Timothy
[Web Search] <elisp:(shell-command "rm -rf ~/*")>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-02-02 12:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-30 16:01 [BUG] Confirmation message for elisp links is badly formatted [9.5.2 (9.5.2-gfbff08 @ /home/omarantolin/.emacs.d/elpa/org-9.5.2/)] Omar Antolín Camarena
2022-01-31 11:38 ` Timothy
2022-02-01 1:06 ` Omar Antolín Camarena
2022-02-01 11:35 ` Max Nikulin
2022-02-01 11:57 ` Timothy
2022-02-02 12:04 ` Max Nikulin
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).