diff --git a/lisp/org-archive.el b/lisp/org-archive.el index 2473d7dac..700e59b6b 100644 --- a/lisp/org-archive.el +++ b/lisp/org-archive.el @@ -158,7 +158,7 @@ archive file is." (save-restriction (goto-char (point-min)) (while (re-search-forward - "^\\(#\\+\\|[ \t]*:\\)ARCHIVE:[ \t]+\\(.*\\)" + "^[ \t]*\\(#\\+\\|:\\)ARCHIVE:[ \t]+\\(.*\\)" nil t) (setq file (org-extract-archive-file (org-match-string-no-properties 2))) diff --git a/lisp/org-element.el b/lisp/org-element.el index 41df4244a..27e9bdaca 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -1284,7 +1284,7 @@ CONTENTS is the contents of the element." (throw 'exit (sort struct 'car-less-than-car)))))) ;; Skip blocks (any type) and drawers contents. (cond - ((and (looking-at "#\\+BEGIN\\(:\\|_\\S-+\\)") + ((and (looking-at "\\(?:[ \t]*\\)?#\\+BEGIN\\(:\\|_\\S-+\\)") (re-search-forward (format "^[ \t]*#\\+END%s[ \t]*$" (org-match-string-no-properties 1)) diff --git a/lisp/org-list.el b/lisp/org-list.el index 4b9744f8d..2ac15af15 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -3044,7 +3044,7 @@ for this list." (unless (org-at-item-p) (error "Not at a list item")) (save-excursion (re-search-backward "#\\+ORGLST" nil t) - (unless (looking-at "#\\+ORGLST:[ \t]+SEND[ \t]+\\(\\S-+\\)[ \t]+\\(\\S-+\\)") + (unless (looking-at "\\(?:[ \t]\\)?#\\+ORGLST:[ \t]+SEND[ \t]+\\(\\S-+\\)[ \t]+\\(\\S-+\\)") (if maybe (throw 'exit nil) (error "Don't know how to transform this list")))) (let* ((name (match-string 1)) diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el index 27dc0e070..3d623bf81 100644 --- a/lisp/org-mouse.el +++ b/lisp/org-mouse.el @@ -638,7 +638,7 @@ This means, between the beginning of line and the point." (progn (save-excursion (goto-char (region-beginning)) (insert "[[")) (save-excursion (goto-char (region-end)) (insert "]]")))] ["Insert Link Here" (org-mouse-yank-link ',event)])))) - ((save-excursion (beginning-of-line) (looking-at "#\\+STARTUP: \\(.*\\)")) + ((save-excursion (beginning-of-line) (looking-at "[ \t]*#\\+STARTUP: \\(.*\\)")) (popup-menu `(nil ,@(org-mouse-list-options-menu (mapcar 'car org-startup-options) diff --git a/lisp/org.el b/lisp/org.el index 1ad5e69f7..1863c00ca 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5938,14 +5938,12 @@ by a #." (add-text-properties beg (match-end 0) '(font-lock-fontified t face font-lock-comment-face))) - ((not (member (char-after beg) '(?\ ?\t))) - ;; just any other in-buffer setting, but not indented + (t ;; just any other in-buffer setting, but not indented (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) (add-text-properties beg (match-end 0) '(font-lock-fontified t face org-meta-line)) - t) - (t nil)))))) + t)))))) (defun org-fontify-drawers (limit) "Fontify drawers." @@ -9344,7 +9342,7 @@ call CMD." (goto-char (point-min)) (put-text-property (point) (point-max) 'org-category def-cat) (while (re-search-forward - "^\\(#\\+CATEGORY:\\|[ \t]*:CATEGORY:\\)\\(.*\\)" nil t) + "^[ \t]*\\(#\\+CATEGORY:\\|[ \t]*:CATEGORY:\\)\\(.*\\)" nil t) (setq pos (match-end 0) optionp (equal (char-after (match-beginning 0)) ?#) cat (org-trim (match-string 2))) @@ -12137,7 +12135,7 @@ expands them." (rpl (nth (if musep 2 1) cell)) (ind "")) (delete-region start (point)) - (when (string-match "\\`#\\+" rpl) + (when (string-match "\\`[ \t]*#\\+" rpl) (cond ((bolp)) ((not (string-match "\\S-" (buffer-substring (point-at-bol) (point)))) @@ -15676,7 +15674,7 @@ formats in the current buffer." (widen) (goto-char (point-min)) (while (re-search-forward - "^\\(#\\+COLUMNS:\\|[ \t]*:COLUMNS:\\)[ \t]*\\(.*\\)" + "^[ \t]*\\(#\\+COLUMNS:\\|[ \t]*:COLUMNS:\\)[ \t]*\\(.*\\)" nil t) (setq cfmt (match-string 2) s 0) (while (string-match (org-re "%[0-9]*\\([-[:alnum:]_]+\\)") @@ -21720,16 +21718,16 @@ and :keyword." ;; New the "medium" contexts: clocktables, source blocks (cond ((org-in-clocktable-p) (push (list :clocktable - (and (or (looking-at "#\\+BEGIN: clocktable") - (search-backward "#+BEGIN: clocktable" nil t)) - (match-beginning 0)) - (and (re-search-forward "#\\+END:?" nil t) + (and (or (looking-at "[ \t]*\\(#\\+BEGIN: clocktable\\)") + (re-search-backward "[ \t]*\\(#+BEGIN: clocktable\\)" nil t)) + (match-beginning 1)) + (and (re-search-forward "[ \t]*#\\+END:?" nil t) (match-end 0))) clist)) ((org-in-src-block-p) (push (list :src-block - (and (or (looking-at "#\\+BEGIN_SRC") - (search-backward "#+BEGIN_SRC" nil t)) - (match-beginning 0)) + (and (or (looking-at "[ \t]*\\(#\\+BEGIN_SRC\\)") + (re-search-backward "[ \t]*\\(#+BEGIN_SRC\\)" nil t)) + (match-beginning 1)) (and (search-forward "#+END_SRC" nil t) (match-beginning 0))) clist)))) (goto-char p)