Przeglądaj źródła

Merge branch 'maint'

Nicolas Goaziou 8 lat temu
rodzic
commit
393dcb7094
2 zmienionych plików z 14 dodań i 9 usunięć
  1. 8 7
      lisp/org-agenda.el
  2. 6 2
      lisp/ox-ascii.el

+ 8 - 7
lisp/org-agenda.el

@@ -7305,14 +7305,15 @@ With a prefix argument, exclude the lines of that category.
        (t (error "No category at point"))))))
 
 (defun org-find-top-headline (&optional pos)
-  "Find the topmost parent headline and return it."
+  "Find the topmost parent headline and return it.
+POS when non-nil is the marker or buffer position to start the
+search from."
   (save-excursion
-    (with-current-buffer (if pos (marker-buffer pos) (current-buffer))
-      (if pos (goto-char pos))
-      ;; Skip up to the topmost parent
-      (while (ignore-errors (outline-up-heading 1) t))
-      (ignore-errors
-	(nth 4 (org-heading-components))))))
+    (with-current-buffer (if (markerp pos) (marker-buffer pos) (current-buffer))
+      (when pos (goto-char pos))
+      ;; Skip up to the topmost parent.
+      (while (org-up-heading-safe))
+      (ignore-errors (nth 4 (org-heading-components))))))
 
 (defvar org-agenda-filtered-by-top-headline nil)
 (defun org-agenda-filter-by-top-headline (strip)

+ 6 - 2
lisp/ox-ascii.el

@@ -1790,7 +1790,9 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
   "Transcode a SUBSCRIPT object from Org to ASCII.
 CONTENTS is the contents of the object.  INFO is a plist holding
 contextual information."
-  (format (if (string-match-p "[ \t]" contents) "_{%s}" "_%s") contents))
+  (if (org-element-property :use-brackets-p subscript)
+      (format "_{%s}" contents)
+    (format "_%s" contents)))
 
 
 ;;;; Superscript
@@ -1799,7 +1801,9 @@ contextual information."
   "Transcode a SUPERSCRIPT object from Org to ASCII.
 CONTENTS is the contents of the object.  INFO is a plist holding
 contextual information."
-  (format (if (string-match-p "[ \t]" contents) "^{%s}" "^%s") contents))
+  (if (org-element-property :use-brackets-p superscript)
+      (format "^{%s}" contents)
+    (format "^%s" contents)))
 
 
 ;;;; Strike-through