emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Robert Klein <roklein@roklein.de>
To: emacs-orgmode@gnu.org
Subject: [BUG] emphasis marker inside macro breaks macro [9.7.16 (release_9.7.16 @ /home/roklein/ot/org-mode/lisp/)]
Date: Wed, 13 Nov 2024 13:19:45 +0100	[thread overview]
Message-ID: <20241113131945.26fe6c33@pcedv2.poly.mpip-mainz.mpg.de> (raw)

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

Hi,

When I have an emphasized section with a macro inside and the macro
contains the emphasis delimiter, macro expansion is broken (i.e. doesn't 
happen, it is exported verbatim, including the braces and the macro name).

In for / and * the emphasis section ends where the delimiter shows up in the Macro 
though not for =.

I attached the emacs configuration used (.temacs), the example org file
as well as exports to ASCII and LaTeX.

I also tested org versions 9.7, 9.6,... down to 9.2 ('make autoloads'
breaks for 9.1), the same happens there as well as on origin/main.

I started emacs using the command “emacs -Q -l .temacs tmp/macrotest.org”

Thanks for any help.

Best regards
Robert



Emacs  : GNU Emacs 29.4 (build 1, x86_64-unknown-openbsd, GTK+ Version 2.24.33, cairo version 1.18.2)
 of 2024-09-28
Package: Org mode version 9.7.16 (release_9.7.16 @ /home/roklein/ot/org-mode/lisp/)

current state:
==============
(setq
 org-link-elisp-confirm-function 'yes-or-no-p
 org-bibtex-headline-format-function 'org-bibtex-headline-format-default
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe
                            org-babel-header-arg-expand)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function
 org-ascii-format-drawer-function '(closure (t) (_name contents _width)
                                    contents)
 org-cycle-hook '(org-cycle-hide-archived-subtrees
                  org-cycle-show-empty-lines
                  org-cycle-optimize-window-after-visibility-change
                  org-cycle-display-inline-images)
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-yank-image-file-name-function 'org-yank-image-autogen-filename
 org-mode-hook '((closure
                  (org--rds reftex-docstruct-symbol org-attach-method
                   org--single-lines-list-is-paragraph
                   org-element-greater-elements org-agenda-restrict-end
                   org-agenda-restrict-begin org-agenda-restrict
                   visual-fill-column-width org-clock-history
                   org-agenda-current-date org-with-time org-defdecode
                   org-def org-read-date-inactive org-ans2 org-ans1
                   org-columns-current-fmt-compiled
                   org-clock-current-task org-clock-effort
                   org-agenda-skip-function org-agenda-skip-comment-trees
                   org-agenda-archives-mode org-end-time-was-given
                   org-time-was-given org-log-note-extra
                   org-log-note-purpose org-log-post-message
                   org-last-inserted-timestamp org-last-changed-timestamp
                   org-entry-property-inherited-from org-state
                   org-agenda-headline-snapshot-before-repeat
                   org-agenda-buffer-name org-agenda-start-on-weekday
                   org-agenda-buffer-tmp-name org-log-note-marker
                   org-priority-regexp org-mode-abbrev-table
                   org-element-cache-persistent org-element-cache-version
                   buffer-face-mode-face org-tbl-menu org-org-menu
                   org-struct-menu org-entities org-last-state
                   org-id-track-globally org-clock-start-time
                   texmathp-why remember-data-file
                   org-agenda-tags-todo-honor-ignore-options
                   calc-embedded-open-mode calc-embedded-open-formula
                   calc-embedded-close-formula align-mode-rules-list
                   org-emphasis-alist org-emphasis-regexp-components
                   org-export-registered-backends org-modules
                   crm-separator org-babel-load-languages
                   org-id-overriding-file-name
                   org-indent-indentation-per-level
                   org-element--timestamp-regexp
                   org-element-cache-map-continue-from
                   org-element-paragraph-separate org-agenda-buffer-name
                   org-inlinetask-min-level t)
                  nil
                  (add-hook 'change-major-mode-hook 'org-fold-show-all
                   'append 'local)
                  )
                 (closure
                  (org-src-window-setup *this*
                   org-babel-confirm-evaluate-answer-no
                   org-babel-tangle-uncomment-comments org-src-lang-modes
                   org-edit-src-content-indentation
                   org-babel-library-of-babel t)
                  nil
                  (add-hook 'change-major-mode-hook
                   #'org-babel-show-result-all 'append 'local)
                  )
                 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-latex-format-drawer-function '(closure
                                    (engrave-faces-latex-mathescape
                                     engrave-faces-current-preset-style
                                     engrave-faces-latex-output-style t)
                                    (_ contents) contents)
 org-latex-format-headline-function 'org-latex-format-headline-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-html-format-drawer-function '(closure
                                   (htmlize-buffer-places
                                    org-html-format-table-no-css
                                    htmlize-css-name-prefix
                                    htmlize-output-type
                                    htmlize-output-type
                                    htmlize-css-name-prefix t)
                                   (_name contents) contents)
 outline-isearch-open-invisible-function 'outline-isearch-open-invisible
 org-sort-function 'string-collate-lessp
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
                     org-src-mode-configure-edit-buffer)
 org-confirm-elisp-link-function 'yes-or-no-p
 org--warnings nil
 org-speed-command-hook '(org-speed-command-activate
                          org-babel-speed-command-activate)
 org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-odt-format-drawer-function '(closure
                                  (hfy-user-sheet-assoc
                                   hfy-html-quote-regex
                                   hfy-html-quote-map hfy-face-to-css
                                   hfy-begin-span-handler
                                   hfy-end-span-handler
                                   archive-zip-extract
                                   nxml-auto-insert-xml-declaration-flag
                                   t)
                                  (_name contents) contents)
 org-persist-directory "/tmp/org-persist-nYIrul"
 org-fold-core-isearch-open-function 'org-fold-core--isearch-reveal
 org-latex-format-inlinetask-function 'org-latex-format-inlinetask-default-function
 org-persist-before-write-hook '(org-element--cache-persist-before-write)
 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 :store
                        org-id-store-link-maybe)
                       ("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
                        :insert-description
                        org-info-description-as-command)
                       ("gnus" :follow org-gnus-open :store
                        org-gnus-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" :follow org-link-doi-open :export
                        org-link-doi-export)
                       ("fm" :export org-fm-export-link) ("file+sys")
                       ("file+emacs")
                       ("shell" :follow org-link--open-shell)
                       ("news" :follow
                        (closure ((scheme . "news")) (url arg)
                         (browse-url (concat scheme ":" url) arg))
                        )
                       ("mailto" :follow
                        (closure ((scheme . "mailto")) (url arg)
                         (browse-url (concat scheme ":" url) arg))
                        )
                       ("https" :follow
                        (closure ((scheme . "https")) (url arg)
                         (browse-url (concat scheme ":" url) arg))
                        )
                       ("http" :follow
                        (closure ((scheme . "http")) (url arg)
                         (browse-url (concat scheme ":" url) arg))
                        )
                       ("ftp" :follow
                        (closure ((scheme . "ftp")) (url arg)
                         (browse-url (concat scheme ":" url) arg))
                        )
                       ("help" :follow org-link--open-help :store
                        org-link--store-help)
                       ("file" :complete org-link-complete-file)
                       ("elisp" :follow org-link--open-elisp))
 org-html-format-headline-function 'org-html-format-headline-default-function
 org-metaup-hook '(org-babel-load-in-session-maybe)
 )





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

Robert Klein


Table of Contents
_________________




- wrong:

  /Open the file {{{Pathname(/ bashrc)}}}/

  /Open the file {{{Pathname(alpha/ bashrc)}}}/

  /Open the file {{{Pathname(~/.bashrc)}}}/

  *bold faced Macro {{{Pathname(*.org)}}}*

  `another {{{Pathname(a = is an equal sign)}}} example'


- Ok:

  /Open the file /bashrc/

  /Open the file ~/*bashrc/

  *Open the file ~/.bashrc*

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: macrotest.tex --]
[-- Type: text/x-tex, Size: 1224 bytes --]

% Created 2024-11-13 Wed 13:05
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\author{Robert Klein}
\date{\today}
\title{}
\hypersetup{
 pdfauthor={Robert Klein},
 pdftitle={},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 29.4 (Org mode 9.7.16)},
 pdflang={English}}
\begin{document}

\tableofcontents

\begin{itemize}
\item wrong:

\emph{Open the file \{\{\{Pathname(} bashrc)\}\}\}/

\emph{Open the file \{\{\{Pathname(alpha} bashrc)\}\}\}/

\emph{Open the file \{\{\{Pathname(\textasciitilde{}}.bashrc)\}\}\}/

\textbf{bold faced Macro  \{\{\{Pathname(}.org)\}\}\}*

\texttt{another \{\{\{Pathname(a = is an equal sign)\}\}\} example}
\end{itemize}


\begin{itemize}
\item Ok:

\emph{Open the file \textit{\texttt{/bashrc}}}

\emph{Open the file \textit{\texttt{\textasciitilde{}/*bashrc}}}

\textbf{Open the file \textit{\texttt{\textasciitilde{}/.bashrc}}}
\end{itemize}
\end{document}

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: macrotest.org --]
[-- Type: text/org, Size: 448 bytes --]

#+Macro: Pathname [[fm:ttit][$1]]

- wrong:

  /Open the file {{{Pathname(/ bashrc)}}}/

  /Open the file {{{Pathname(alpha/ bashrc)}}}/

  /Open the file {{{Pathname(~/.bashrc)}}}/

  *bold faced Macro  {{{Pathname(*.org)}}}*

  =another {{{Pathname(a = is an equal sign)}}} example=


- Ok:

  /Open the file {{{Pathname(/bashrc)}}}/

  /Open the file {{{Pathname(~/*bashrc)}}}/

  *Open the file {{{Pathname(~/.bashrc)}}}*

[-- Attachment #5: .temacs --]
[-- Type: application/octet-stream, Size: 2103 bytes --]


(defun rk/org-toggle-link-display ()
  "Toggle the literal or descriptive display of links."
  (interactive)
  (if org-descriptive-links
      (progn (org-remove-from-invisibility-spec '(org-link))
             (org-restart-font-lock)
             (setq org-descriptive-links nil))
    (progn (add-to-invisibility-spec '(org-link))
           (org-restart-font-lock)
           (setq org-descriptive-links t))))

(defun org-fm-export-link (path desc format)
  (cond
   ((eq format 'html)
    (cond
     ((equal path "sc")
      (format "<span style=\"font-variant:small-caps;\">%s</span>"
              desc))
     ((equal path "it")
      (format "<em>%s</em>" desc))
     ((equal path "bf")
      (format "<strong>%s</strong>" desc))
     ((equal path "tt")
      (format "<code>%s</code>" desc))
     ((equal path "ttit")
      (format "<code><em>%s</em></code>" desc))
     ((equal path "ttbf")
      (format "<code><strong>%s</strong></code>" desc))
     ((equal path "ttbfit")
      (format "<code><strong><em>%s</em></strong></code>" desc))
     ((equal path "Oxman")
      (let ((mp (split-string desc ",")))
        (format "<a href=\"https://man.openbsd.org/%s.%s\"><em><code>%s</code>(%s)</em></a>"
                (second mp) (first mp) (second mp) (first mp))))
     (t (format "%s" desc))))
   ((eq format 'latex)
    (cond
     ((equal path "ttit")
      (format "\\textit{\\texttt{%s}}" desc))
     ((equal path "ttbf")
      (format "\\textbf{\\texttt{%s}}" desc))
     ((equal path "ttbfit")
      (format "\\textbf{\\textit{\\texttt{%s}}}" desc))
     ((equal path "Oxman")
      (let ((mp (split-string desc ",")))
        (format "\\href{https://man.openbsd.org/%s.%s}{\\textit{\\texttt{%s}(%s)}}"
                (second mp) (first mp) (second mp) (first mp))))
     (t (format "\\text%s{%s}" path desc))))
   ((eq format 'ascii)
    (format "%s" desc))
   (t (format "%s" desc))))

(use-package org
  :load-path "~/ot/org-mode/lisp"
  :config
  (org-link-set-parameters "fm" :export #'org-fm-export-link)
  (define-key org-mode-map (kbd "C-c t") 'rk/org-toggle-link-display)
  )

                 reply	other threads:[~2024-11-13 12:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20241113131945.26fe6c33@pcedv2.poly.mpip-mainz.mpg.de \
    --to=roklein@roklein.de \
    --cc=emacs-orgmode@gnu.org \
    /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).