From: Bastien Guerry Date: Thu, 7 Feb 2013 07:11:59 +0000 (+0100) Subject: Merge Org 7.9.3e (commit b07a9bb). X-Git-Tag: emacs-24.2.93~2 X-Git-Url: https://code.delx.au/gnu-emacs/commitdiff_plain/d351707783bbc9b42168d14f566dd63a8ecd9a1c Merge Org 7.9.3e (commit b07a9bb). --- diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 49ef90d3da..1b454741fc 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,10 @@ +2013-02-07 Bastien Guerry + + * org.texi (References): Clarify an example. + (Installation): Fix instructions. + (Org-Plot): Fix link. + (Checkboxes, Radio lists): Fix typos. + 2013-02-06 Glenn Morris * cl.texi (Equality Predicates): Mention memql. diff --git a/doc/misc/org.texi b/doc/misc/org.texi index d41d2848cc..7b880fc386 100644 --- a/doc/misc/org.texi +++ b/doc/misc/org.texi @@ -2,7 +2,7 @@ @c %**start of header @setfilename ../../info/org @settitle The Org Manual -@set VERSION 7.9.3d (GNU Emacs 24.3) +@set VERSION 7.9.3e (GNU Emacs 24.3) @c Use proper quote and backtick for code sections in PDF output @c Cf. Texinfo manual 14.2 @@ -903,17 +903,20 @@ $ git clone git://orgmode.org/org-mode.git $ make autoloads @end example -Note that @code{make autoloads} is mandatory: it defines Org's version and -Org's autoloaded functions, respectively in @file{org-version.el} and in +Note that in this case, @code{make autoloads} is mandatory: it defines Org's +version in @file{org-version.el} and Org's autoloads in @file{org-loaddefs.el}. Remember to add the correct load-path as described in the method above. -You can also compile and install Org from this git repository: check -@code{make help} to get the list of compilation/installation options. +You can also compile with @code{make}, generate the documentation with +@code{make doc}, create a local configuration with @code{make config} and +install Org with @code{make install}. Please run @code{make help} to get +the list of compilation/installation options. For more detailed explanations on Org's build system, please check the Org -Build System page on @uref{http://orgmode.org/worg/dev/org-build-system.html, Worg}. +Build System page on @uref{http://orgmode.org/worg/dev/org-build-system.html, +Worg}. @node Activation, Feedback, Installation, Introduction @section Activation @@ -2444,7 +2447,7 @@ $1..$3 @r{first three fields in the current row} $P..$Q @r{range, using column names (see under Advanced)} $<<<..$>> @r{start in third column, continue to the one but last} @@2$1..@@4$3 @r{6 fields between these two fields (same as @code{A2..C4})} -@@-1$-2..@@-1 @r{3 numbers from the column to the left, 2 up to current row} +@@-1$-2..@@-1 @r{in the first row up, 3 fields from 2 columns on the left} @@I..II @r{between first and second hline, short for @code{@@I..@@II}} @end example @@ -3023,9 +3026,9 @@ functions. Org-Plot can produce 2D and 3D graphs of information stored in org tables using @file{Gnuplot} @uref{http://www.gnuplot.info/} and @file{gnuplot-mode} -@uref{http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html}. To see -this in action, ensure that you have both Gnuplot and Gnuplot mode installed -on your system, then call @code{org-plot/gnuplot} on the following table. +@uref{http://xafs.org/BruceRavel/GnuplotMode}. To see this in action, ensure +that you have both Gnuplot and Gnuplot mode installed on your system, then +call @code{org-plot/gnuplot} on the following table. @example @group @@ -4486,7 +4489,7 @@ off a box while there are unchecked boxes above it. @orgcmd{C-c C-c,org-toggle-checkbox} Toggle checkbox status or (with prefix arg) checkbox presence at point. With a single prefix argument, add an empty checkbox or remove the current -one@footnote{`C-u C-c C-c' on the @emph{first} item of a list with no checkbox +one@footnote{@kbd{C-u C-c C-c} on the @emph{first} item of a list with no checkbox will add checkboxes to the rest of the list.}. With a double prefix argument, set it to @samp{[-]}, which is considered to be an intermediate state. @orgcmd{C-c C-x C-b,org-toggle-checkbox} @@ -15987,7 +15990,7 @@ Here is a @LaTeX{} example. Let's say that you have this in your \end@{comment@} @end example -Pressing `C-c C-c' on @code{a new house} and will insert the converted +Pressing @kbd{C-c C-c} on @code{a new house} and will insert the converted @LaTeX{} list between the two marker lines. @node Dynamic blocks, Special agenda views, Tables in arbitrary syntax, Hacking diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog index b6d196ecf5..03a0560fea 100644 --- a/lisp/org/ChangeLog +++ b/lisp/org/ChangeLog @@ -1,3 +1,120 @@ +2013-02-07 Bastien Guerry + + * org-agenda.el (org-agenda-get-deadlines) + (org-agenda-get-scheduled): Fix bug: use text properties for the + headline text since we rely on properties to get e.g. the effort. + + * org-exp.el (org-export-normalize-links): Don't match links + within tags. + + * org-html.el (org-export-html-preamble-format) + (org-export-html-postamble-format): Mention that + org-export-html-preamble/postamble need to be `t' in order for + these variables to have any effect. + + * org-html.el (org-html-handle-links): When the link description + is an image and the attribute is "width", pass the attribute to + the tag. + + * org.el (org-mode): Always honor `org-startup-indented', even + when `org-inhibit-startup' is non-nil. + + * org-indent.el (org-indent-mode): Don't check + `org-inhibit-startup'. + + * org.el (org-fontify-meta-lines-and-blocks-1): Don't try to add + text properties outside of the buffer. + + * org.el (org-agenda-inhibit-startup): Rename from + `org-agenda-inhibit-startup-visibility-cycling'. + (org-agenda-prepare-buffers): Bind `org-inhibit-startup' to + `org-agenda-inhibit-startup'. + + * org.el (org-mode): Don't initialize `org-beamer-mode' when + `org-inhibit-startup' is non-nil. + + * org-footnote.el (org-footnote-create-definition): Prevent + `electric-indent-mode' from inserting the definition at the wrong + place. + + * org-agenda.el (org-agenda-no-heading-message): Delete. + (org-agenda-get-timestamps, org-agenda-get-progress) + (org-agenda-get-deadlines, org-agenda-get-scheduled) + (org-agenda-get-blocks): Don't use + `org-agenda-no-heading-message', skip the entry. + + * org.el (org-agenda-inhibit-startup-visibility-cycling): New + option. + (org-agenda-prepare-buffers): Use it to speed up the agenda + generation. + + * org-agenda.el (org-agenda-skip): Fix bug by correctly skipping + commented scheduled/deadline lines. + + * org-clock.el (org-clock-in): Fix bug when fetching the effort + value. + + * ob-python.el (org-babel-python-command): Fix docstring. + (org-babel-python-initiate-session-by-key): Fix bug: `run-python' + from Emacs >24.1 requires a python command as an argument. + + * org-element.el (org-element-at-point): Fix typo in docstring. + + * org-agenda.el (org-agenda-get-deadlines): Fix bug: use + `org-agenda-show-inherited-tags'. + + * org-agenda.el (org-agenda-skip): Correctly handle commented out + scheduled/deadline lines. Refactor. + + * org-install.el: Do not warn users. + + * org.el (org-adaptive-fill-function): In message-mode, don't + lines in the message header, nor table lines in the body. + Correctly fill lines starting with `org-outline-regexp' in the + body. + + * org-agenda.el (org-agenda-open-link): Fix bug with opening all + links. + +2013-02-07 Francesco Pizzolante (tiny change) + + * org-clock.el (org-clock-sum): Protect with `org-unmodified'. + + * org-macs.el (org-unmodified): Inhibit modification hooks. + +2013-02-07 John K. Luebs (tiny change) + + * org.el (org-get-wdays): Handle matching a lead time specified in + hours. + +2013-02-07 Muchenxuan Tong (tiny change) + + * org-agenda.el (org-agenda-quit): Delete indirect buffer's window + only when it exists. + +2013-02-07 Nicolas Goaziou + + * org-element.el (org-element-macro-parser): Fix error when last + argument ends with a protected comma. + + * org-element.el (org-element-parse-buffer, org-element-map) + (org-element-at-point, org-element-context): Be more verbose in + docstrings. Also fix typos. + + * org-list.el (org-list-struct-fix-box): When a checkbox has to be + resetted because of a non-nil ORDERED property value, make sure it + had a checkbox already. + +2013-02-07 Tokuya Kameshima (tiny change) + + * org-agenda.el (org-search-view): Fix checking + `org-agenda-show-inherited-tags'. + +2013-02-07 racin (tiny change) + + * org-bibtex.el (org-bibtex-search): Don't throw an error when + `org-bibtex-prefix' is nil. + 2013-01-13 Bastien Guerry * org-compat.el (org-condition-case-unless-debug): Delete. diff --git a/lisp/org/ob-python.el b/lisp/org/ob-python.el index 55dd1c7cda..79cc53ea0f 100644 --- a/lisp/org/ob-python.el +++ b/lisp/org/ob-python.el @@ -44,7 +44,7 @@ (defvar org-babel-default-header-args:python '()) (defvar org-babel-python-command "python" - "Name of command for executing Python code.") + "Name of the command for executing Python code.") (defvar org-babel-python-mode (if (featurep 'xemacs) 'python-mode 'python) "Preferred python mode for use in running python interactively. @@ -143,7 +143,9 @@ then create. Return the initialized session." (cond ((and (eq 'python org-babel-python-mode) (fboundp 'run-python)) ; python.el - (run-python)) + (if (version< "24.1" emacs-version) + (run-python org-babel-python-command) + (run-python))) ((and (eq 'python-mode org-babel-python-mode) (fboundp 'py-shell)) ; python-mode.el ;; Make sure that py-which-bufname is initialized, as otherwise diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index ca8459ca33..9b6dcaed8c 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -530,7 +530,7 @@ This is a list of four items: the project is considered to be not stuck. If you specify \"*\" as a tag, any tag will mark the project unstuck. Note that this is about the explicit presence of a tag somewhere in the subtree, inherited - tags to not count here. If inherited tags make a project not stuck, + tags do not count here. If inherited tags make a project not stuck, use \"-TAG\" in the tags part of the matcher under (1.) above. 4. An arbitrary regular expression matching non-stuck projects. @@ -3728,19 +3728,18 @@ A good way to set it is through options in `org-agenda-custom-commands'.") Also moves point to the end of the skipped region, so that search can continue from there." (let ((p (point-at-bol)) to) - (when (org-in-src-block-p t) (throw :skip t)) - (and org-agenda-skip-archived-trees (not org-agenda-archives-mode) - (get-text-property p :org-archived) - (org-end-of-subtree t) - (throw :skip t)) - (and org-agenda-skip-comment-trees - (get-text-property p :org-comment) - (org-end-of-subtree t) - (throw :skip t)) - (if (equal (char-after p) ?#) (throw :skip t)) - (when (setq to (or (org-agenda-skip-eval org-agenda-skip-function-global) - (org-agenda-skip-eval org-agenda-skip-function))) - (goto-char to) + (when (or + (save-excursion (goto-char p) (looking-at comment-start-skip)) + (and org-agenda-skip-archived-trees (not org-agenda-archives-mode) + (get-text-property p :org-archived) + (org-end-of-subtree t)) + (and org-agenda-skip-comment-trees + (get-text-property p :org-comment) + (org-end-of-subtree t)) + (and (setq to (or (org-agenda-skip-eval org-agenda-skip-function-global) + (org-agenda-skip-eval org-agenda-skip-function))) + (goto-char to)) + (org-in-src-block-p t)) (throw :skip t)))) (defun org-agenda-skip-eval (form) @@ -4479,7 +4478,8 @@ in `org-agenda-text-search-extra-files'." category-pos (get-text-property (point) 'org-category-position) inherited-tags (or (eq org-agenda-show-inherited-tags 'always) - (memq 'todo org-agenda-show-inherited-tags) + (and (listp org-agenda-show-inherited-tags) + (memq 'todo org-agenda-show-inherited-tags)) (and (eq org-agenda-show-inherited-tags t) (or (eq org-agenda-use-tag-inheritance t) (memq 'todo org-agenda-use-tag-inheritance)))) @@ -5406,9 +5406,6 @@ Do we have a reason to ignore this TODO entry because it has a time stamp? \(fn &optional END)" nil nil) -(defconst org-agenda-no-heading-message - "No heading for this item in buffer or region.") - (defun org-agenda-get-timestamps (&optional deadline-results) "Return the date stamp information for agenda display." (let* ((props (list 'face 'org-agenda-calendar-event @@ -5488,7 +5485,7 @@ Do we have a reason to ignore this TODO entry because it has a time stamp? category-pos (get-text-property b0 'org-category-position)) (save-excursion (if (not (re-search-backward org-outline-regexp-bol nil t)) - (setq txt org-agenda-no-heading-message) + (throw :skip nil) (goto-char (match-beginning 0)) (if (and (eq t org-agenda-skip-timestamp-if-deadline-is-shown) (assoc (point) deadline-position-alist)) @@ -5724,7 +5721,7 @@ please use `org-class' instead." (and (looking-at ".*\n[ \t]*-[ \t]+\\([^-\n \t].*?\\)[ \t]*$") (match-string 1))))) (if (not (re-search-backward org-outline-regexp-bol nil t)) - (setq txt org-agenda-no-heading-message) + (throw :skip nil) (goto-char (match-beginning 0)) (setq hdmarker (org-agenda-new-marker) inherited-tags @@ -5892,7 +5889,7 @@ See also the user option `org-agenda-clock-consistency-checks'." (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar d2 diff dfrac wdays pos pos1 category category-pos tags suppress-prewarning ee txt head face s todo-state - show-all upcomingp donep timestr warntime) + show-all upcomingp donep timestr warntime inherited-tags) (goto-char (point-min)) (while (re-search-forward regexp nil t) (setq suppress-prewarning nil) @@ -5941,11 +5938,18 @@ See also the user option `org-agenda-clock-consistency-checks'." warntime (get-text-property (point) 'org-appt-warntime) category-pos (get-text-property (point) 'org-category-position)) (if (not (re-search-backward "^\\*+[ \t]+" nil t)) - (setq txt org-agenda-no-heading-message) + (throw :skip nil) (goto-char (match-end 0)) (setq pos1 (match-beginning 0)) - (setq tags (org-get-tags-at pos1 t)) - (setq head (buffer-substring-no-properties + (setq inherited-tags + (or (eq org-agenda-show-inherited-tags 'always) + (and (listp org-agenda-show-inherited-tags) + (memq 'agenda org-agenda-show-inherited-tags)) + (and (eq org-agenda-show-inherited-tags t) + (or (eq org-agenda-use-tag-inheritance t) + (memq 'agenda org-agenda-use-tag-inheritance)))) + tags (org-get-tags-at pos1 (not inherited-tags))) + (setq head (buffer-substring (point) (progn (skip-chars-forward "^\r\n") (point)))) @@ -6059,7 +6063,7 @@ FRACTION is what fraction of the head-warning time has passed." (setq category (org-get-category) category-pos (get-text-property (point) 'org-category-position)) (if (not (re-search-backward "^\\*+[ \t]+" nil t)) - (setq txt org-agenda-no-heading-message) + (throw :skip nil) (goto-char (match-end 0)) (setq pos1 (match-beginning 0)) (if habitp @@ -6082,7 +6086,7 @@ FRACTION is what fraction of the head-warning time has passed." (or (eq org-agenda-use-tag-inheritance t) (memq 'agenda org-agenda-use-tag-inheritance)))) tags (org-get-tags-at nil (not inherited-tags))) - (setq head (buffer-substring-no-properties + (setq head (buffer-substring (point) (progn (skip-chars-forward "^\r\n") (point)))) (if (string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s) @@ -6160,7 +6164,7 @@ FRACTION is what fraction of the head-warning time has passed." (setq category (org-get-category) category-pos (get-text-property (point) 'org-category-position)) (if (not (re-search-backward org-outline-regexp-bol nil t)) - (setq txt org-agenda-no-heading-message) + (throw :skip nil) (goto-char (match-beginning 0)) (setq hdmarker (org-agenda-new-marker (point)) inherited-tags @@ -6892,7 +6896,10 @@ Allowed types are 'agenda 'timeline 'todo 'tags 'search." (interactive) (if (and (eq org-indirect-buffer-display 'other-window) org-last-indirect-buffer) - (delete-window (get-buffer-window org-last-indirect-buffer))) + (let ((org-last-indirect-window + (get-buffer-window org-last-indirect-buffer))) + (if org-last-indirect-window + (delete-window org-last-indirect-window)))) (if org-agenda-columns-active (org-columns-quit) (if org-agenda-sticky @@ -8012,32 +8019,34 @@ It also looks at the text of the entry itself." (let* ((marker (or (org-get-at-bol 'org-hd-marker) (org-get-at-bol 'org-marker))) (buffer (and marker (marker-buffer marker))) - (prefix (buffer-substring - (point-at-bol) (point-at-eol))) + (prefix (buffer-substring (point-at-bol) (point-at-eol))) (lkall (org-offer-links-in-entry buffer marker arg prefix)) - (lk (car lkall)) + (lk0 (car lkall)) + (lk (if (stringp lk0) (list lk0) lk0)) (lkend (cdr lkall)) trg) (cond - ((and buffer (stringp lk)) - (with-current-buffer buffer - (setq trg (and (string-match org-bracket-link-regexp lk) - (match-string 1 lk))) - (if (or (not trg) (string-match org-any-link-re trg)) - (save-excursion - (save-restriction - (widen) - (goto-char marker) - (when (search-forward lk nil lkend) - (goto-char (match-beginning 0)) - (org-open-at-point)))) - ;; This is an internal link, widen the buffer - (switch-to-buffer-other-window buffer) - (widen) - (goto-char marker) - (when (search-forward lk nil lkend) - (goto-char (match-beginning 0)) - (org-open-at-point))))) + ((and buffer lk) + (mapcar (lambda(l) + (with-current-buffer buffer + (setq trg (and (string-match org-bracket-link-regexp l) + (match-string 1 l))) + (if (or (not trg) (string-match org-any-link-re trg)) + (save-excursion + (save-restriction + (widen) + (goto-char marker) + (when (search-forward l nil lkend) + (goto-char (match-beginning 0)) + (org-open-at-point)))) + ;; This is an internal link, widen the buffer + (switch-to-buffer-other-window buffer) + (widen) + (goto-char marker) + (when (search-forward l nil lkend) + (goto-char (match-beginning 0)) + (org-open-at-point))))) + lk)) ((or (org-in-regexp (concat "\\(" org-bracket-link-regexp "\\)")) (save-excursion (beginning-of-line 1) diff --git a/lisp/org/org-bibtex.el b/lisp/org/org-bibtex.el index 6827bdacb5..704b20497b 100644 --- a/lisp/org/org-bibtex.el +++ b/lisp/org/org-bibtex.el @@ -679,7 +679,7 @@ This function relies `org-search-view' to locate results." (org-agenda-search-view-always-boolean t)) (org-search-view nil (format "%s +{:%s%s:}" - string org-bibtex-prefix + string (or org-bibtex-prefix "") org-bibtex-type-property-name)))) (provide 'org-bibtex) diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index c043dd19e1..bc0c431ddd 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -1204,7 +1204,7 @@ make this the default behavior.)" (setq org-clock-start-time (apply 'encode-time (org-parse-time-string (match-string 1)))) - (setq org-clock-effort (get-text-property (point) 'org-effort)) + (setq org-clock-effort (org-entry-get (point) org-effort-property)) (setq org-clock-total-time (org-clock-sum-current-item (org-clock-get-sum-start)))) ((eq org-clock-in-resume 'auto-restart) @@ -1224,7 +1224,7 @@ make this the default behavior.)" (beginning-of-line 1) (org-indent-line-to (- (org-get-indentation) 2))) (insert org-clock-string " ") - (setq org-clock-effort (get-text-property (point) 'org-effort)) + (setq org-clock-effort (org-entry-get (point) org-effort-property)) (setq org-clock-total-time (org-clock-sum-current-item (org-clock-get-sum-start))) (setq org-clock-start-time @@ -1675,86 +1675,85 @@ each headline in the time range with point at the headline. Headlines for which HEADLINE-FILTER returns nil are excluded from the clock summation. PROPNAME lets you set a custom text property instead of :org-clock-minutes." (interactive) - (let* ((bmp (buffer-modified-p)) - (re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*" - org-clock-string - "[ \t]*\\(?:\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)\\|=>[ \t]+\\([0-9]+\\):\\([0-9]+\\)\\)")) - (lmax 30) - (ltimes (make-vector lmax 0)) - (t1 0) - (level 0) - ts te dt - time) - (if (stringp tstart) (setq tstart (org-time-string-to-seconds tstart))) - (if (stringp tend) (setq tend (org-time-string-to-seconds tend))) - (if (consp tstart) (setq tstart (org-float-time tstart))) - (if (consp tend) (setq tend (org-float-time tend))) - (remove-text-properties (point-min) (point-max) - `(,(or propname :org-clock-minutes) t - :org-clock-force-headline-inclusion t)) - (save-excursion - (goto-char (point-max)) - (while (re-search-backward re nil t) - (cond - ((match-end 2) - ;; Two time stamps - (setq ts (match-string 2) - te (match-string 3) - ts (org-float-time - (apply 'encode-time (org-parse-time-string ts))) - te (org-float-time - (apply 'encode-time (org-parse-time-string te))) - ts (if tstart (max ts tstart) ts) - te (if tend (min te tend) te) - dt (- te ts) - t1 (if (> dt 0) (+ t1 (floor (/ dt 60))) t1))) - ((match-end 4) - ;; A naked time - (setq t1 (+ t1 (string-to-number (match-string 5)) - (* 60 (string-to-number (match-string 4)))))) - (t ;; A headline - ;; Add the currently clocking item time to the total - (when (and org-clock-report-include-clocking-task - (equal (org-clocking-buffer) (current-buffer)) - (equal (marker-position org-clock-hd-marker) (point)) - tstart - tend - (>= (org-float-time org-clock-start-time) tstart) - (<= (org-float-time org-clock-start-time) tend)) - (let ((time (floor (- (org-float-time) - (org-float-time org-clock-start-time)) 60))) - (setq t1 (+ t1 time)))) - (let* ((headline-forced - (get-text-property (point) - :org-clock-force-headline-inclusion)) - (headline-included - (or (null headline-filter) - (save-excursion - (save-match-data (funcall headline-filter)))))) - (setq level (- (match-end 1) (match-beginning 1))) - (when (or (> t1 0) (> (aref ltimes level) 0)) - (when (or headline-included headline-forced) - (if headline-included - (loop for l from 0 to level do - (aset ltimes l (+ (aref ltimes l) t1)))) - (setq time (aref ltimes level)) - (goto-char (match-beginning 0)) - (put-text-property (point) (point-at-eol) - (or propname :org-clock-minutes) time) - (if headline-filter - (save-excursion - (save-match-data - (while - (> (funcall outline-level) 1) - (outline-up-heading 1 t) - (put-text-property - (point) (point-at-eol) - :org-clock-force-headline-inclusion t)))))) - (setq t1 0) - (loop for l from level to (1- lmax) do - (aset ltimes l 0))))))) - (setq org-clock-file-total-minutes (aref ltimes 0))) - (set-buffer-modified-p bmp))) + (org-unmodified + (let* ((re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*" + org-clock-string + "[ \t]*\\(?:\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)\\|=>[ \t]+\\([0-9]+\\):\\([0-9]+\\)\\)")) + (lmax 30) + (ltimes (make-vector lmax 0)) + (t1 0) + (level 0) + ts te dt + time) + (if (stringp tstart) (setq tstart (org-time-string-to-seconds tstart))) + (if (stringp tend) (setq tend (org-time-string-to-seconds tend))) + (if (consp tstart) (setq tstart (org-float-time tstart))) + (if (consp tend) (setq tend (org-float-time tend))) + (remove-text-properties (point-min) (point-max) + `(,(or propname :org-clock-minutes) t + :org-clock-force-headline-inclusion t)) + (save-excursion + (goto-char (point-max)) + (while (re-search-backward re nil t) + (cond + ((match-end 2) + ;; Two time stamps + (setq ts (match-string 2) + te (match-string 3) + ts (org-float-time + (apply 'encode-time (org-parse-time-string ts))) + te (org-float-time + (apply 'encode-time (org-parse-time-string te))) + ts (if tstart (max ts tstart) ts) + te (if tend (min te tend) te) + dt (- te ts) + t1 (if (> dt 0) (+ t1 (floor (/ dt 60))) t1))) + ((match-end 4) + ;; A naked time + (setq t1 (+ t1 (string-to-number (match-string 5)) + (* 60 (string-to-number (match-string 4)))))) + (t ;; A headline + ;; Add the currently clocking item time to the total + (when (and org-clock-report-include-clocking-task + (equal (org-clocking-buffer) (current-buffer)) + (equal (marker-position org-clock-hd-marker) (point)) + tstart + tend + (>= (org-float-time org-clock-start-time) tstart) + (<= (org-float-time org-clock-start-time) tend)) + (let ((time (floor (- (org-float-time) + (org-float-time org-clock-start-time)) 60))) + (setq t1 (+ t1 time)))) + (let* ((headline-forced + (get-text-property (point) + :org-clock-force-headline-inclusion)) + (headline-included + (or (null headline-filter) + (save-excursion + (save-match-data (funcall headline-filter)))))) + (setq level (- (match-end 1) (match-beginning 1))) + (when (or (> t1 0) (> (aref ltimes level) 0)) + (when (or headline-included headline-forced) + (if headline-included + (loop for l from 0 to level do + (aset ltimes l (+ (aref ltimes l) t1)))) + (setq time (aref ltimes level)) + (goto-char (match-beginning 0)) + (put-text-property (point) (point-at-eol) + (or propname :org-clock-minutes) time) + (if headline-filter + (save-excursion + (save-match-data + (while + (> (funcall outline-level) 1) + (outline-up-heading 1 t) + (put-text-property + (point) (point-at-eol) + :org-clock-force-headline-inclusion t)))))) + (setq t1 0) + (loop for l from level to (1- lmax) do + (aset ltimes l 0))))))) + (setq org-clock-file-total-minutes (aref ltimes 0)))))) (defun org-clock-sum-current-item (&optional tstart) "Return time, clocked on current item in total." diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el index c8096aa396..6a0b8eee45 100644 --- a/lisp/org/org-element.el +++ b/lisp/org/org-element.el @@ -2893,10 +2893,13 @@ Assume point is at the macro." (end (point)) (args (let ((args (org-match-string-no-properties 3)) args2) (when args - (setq args (org-split-string args ",")) + ;; Do not use `org-split-string' since empty + ;; strings are meaningful here. + (setq args (split-string args ",")) (while args (while (string-match "\\\\\\'" (car args)) - ;; Repair bad splits. + ;; Repair bad splits, when comma is protected, + ;; and thus not a real separator. (setcar (cdr args) (concat (substring (car args) 0 -1) "," (nth 1 args))) (pop args)) @@ -3611,7 +3614,32 @@ recursion. It can be set to the following symbols: When VISIBLE-ONLY is non-nil, don't parse contents of hidden elements. -Assume buffer is in Org mode." +An element or an objects is represented as a list with the +pattern (TYPE PROPERTIES CONTENTS), where : + + TYPE is a symbol describing the element or object. See + `org-element-all-elements' and `org-element-all-objects' for an + exhaustive list of such symbols. One can retrieve it with + `org-element-type' function. + + PROPERTIES is the list of attributes attached to the element or + object, as a plist. Although most of them are specific to the + element or object type, all types share `:begin', `:end', + `:post-blank' and `:parent' properties, which respectively + refer to buffer position where the element or object starts, + ends, the number of white spaces or blank lines after it, and + the element or object containing it. Properties values can be + obtained by using `org-element-property' function. + + CONTENTS is a list of elements, objects or raw strings + contained in the current element or object, when applicable. + One can access them with `org-element-contents' function. + +The Org buffer has `org-data' as type and nil as properties. +`org-element-map' function can be used to find specific elements +or objects within the parse tree. + +This function assumes that current major mode is `org-mode'." (save-excursion (goto-char (point-min)) (org-skip-whitespace) @@ -3640,11 +3668,12 @@ containing the secondary string. It is used to set correctly (defun org-element-map (data types fun &optional info first-match no-recursion) "Map a function on selected elements or objects. -DATA is the parsed tree, as returned by, i.e, +DATA is an Org buffer parse tree, as returned by, i.e, `org-element-parse-buffer'. TYPES is a symbol or list of symbols -of elements or objects types. FUN is the function called on the -matching element or object. It must accept one arguments: the -element or object itself. +of elements or objects types (see `org-element-all-elements' and +`org-element-all-objects' for a complete list of types). FUN is +the function called on the matching element or object. It has to +accept one argument: the element or object itself. When optional argument INFO is non-nil, it should be a plist holding export options. In that case, parts of the parse tree @@ -3658,7 +3687,37 @@ representing elements or objects types. `org-element-map' won't enter any recursive element or object whose type belongs to that list. Though, FUN can still be applied on them. -Nil values returned from FUN do not appear in the results." +Nil values returned from FUN do not appear in the results. + + +Examples: +-------- + +Assuming TREE is a variable containing an Org buffer parse tree, +the following example will return a flat list of all `src-block' +and `example-block' elements in it: + + \(org-element-map tree '(example-block src-block) 'identity) + +The following snippet will find the first headline with a level +of 1 and a \"phone\" tag, and will return its beginning position: + + \(org-element-map + tree 'headline + \(lambda (hl) + \(and (= (org-element-property :level hl) 1) + \(member \"phone\" (org-element-property :tags hl)) + \(org-element-property :begin hl))) + nil t) + +Eventually, this last example will return a flat list of all +`bold' type objects containing a `latex-snippet' type object: + + \(org-element-map + tree 'bold + \(lambda (b) + \(and (org-element-map b 'latex-snippet 'identity nil t) + b)))" ;; Ensure TYPES and NO-RECURSION are a list, even of one element. (unless (listp types) (setq types (list types))) (unless (listp no-recursion) (setq no-recursion (list no-recursion))) @@ -4168,8 +4227,8 @@ of the element and PROPS a plist of properties associated to the element. Possible types are defined in `org-element-all-elements'. -Properties depend on element or object type, but always -include :begin, :end, :parent and :post-blank properties. +Properties depend on element or object type, but always include +`:begin', `:end', `:parent' and `:post-blank' properties. As a special case, if point is at the very beginning of a list or sub-list, returned element will be that list instead of the first @@ -4178,8 +4237,8 @@ row of a table, returned element will be the table instead of the first row. If optional argument KEEP-TRAIL is non-nil, the function returns -a list of of elements leading to element at point. The list's -CAR is always the element at point. Following positions contain +a list of elements leading to element at point. The list's CAR +is always the element at point. The following positions contain element's siblings, then parents, siblings of parents, until the first element of current section." (org-with-wide-buffer @@ -4268,8 +4327,8 @@ associated to it. Possible types are defined in `org-element-all-elements' and `org-element-all-objects'. Properties depend on element or -object type, but always include :begin, :end, :parent -and :post-blank properties." +object type, but always include `:begin', `:end', `:parent' and +`:post-blank'." (org-with-wide-buffer (let* ((origin (point)) (element (org-element-at-point)) diff --git a/lisp/org/org-exp.el b/lisp/org/org-exp.el index 82b9003e4f..5ccaec3e67 100644 --- a/lisp/org/org-exp.el +++ b/lisp/org/org-exp.el @@ -2113,7 +2113,8 @@ Also, store forced alignment information found in such lines." (put-text-property (match-beginning 0) (match-end 0) 'org-normalized-link t)) (goto-char (point-min)) (while (re-search-forward re-plain-link nil t) - (unless (get-text-property (match-beginning 0) 'org-normalized-link) + (unless (or (get-text-property (match-beginning 0) 'org-normalized-link) + (assoc :tags (org-context))) (goto-char (1- (match-end 0))) (org-if-unprotected-at (1+ (match-beginning 0)) (let* ((s (concat (match-string 1) diff --git a/lisp/org/org-footnote.el b/lisp/org/org-footnote.el index 269ea8ebf9..4cde24bf57 100644 --- a/lisp/org/org-footnote.el +++ b/lisp/org/org-footnote.el @@ -486,7 +486,8 @@ or new, let the user edit the definition of the footnote." (defun org-footnote-create-definition (label) "Start the definition of a footnote with label LABEL." (interactive "sLabel: ") - (let ((label (org-footnote-normalize-label label))) + (let ((label (org-footnote-normalize-label label)) + electric-indent-mode) ;; Prevent wrong indentation (cond ;; In an Org file. ((derived-mode-p 'org-mode) diff --git a/lisp/org/org-html.el b/lisp/org/org-html.el index 493d8a28af..ca90f855aa 100644 --- a/lisp/org/org-html.el +++ b/lisp/org/org-html.el @@ -464,6 +464,9 @@ precedence over this variable." (defcustom org-export-html-preamble-format '(("en" "")) "Alist of languages and format strings for the HTML preamble. +To enable the HTML exporter to use these formats, you need to set +`org-export-html-preamble' to `t'. + The first element of each list is the language code, as used for the #+LANGUAGE keyword. @@ -510,6 +513,9 @@ precedence over this variable." ")) "Alist of languages and format strings for the HTML postamble. +To enable the HTML exporter to use these formats, you need to set +`org-export-html-postamble' to `t'. + The first element of each list is the language code, as used for the #+LANGUAGE keyword. @@ -1030,7 +1036,10 @@ OPT-PLIST is the export options list." (if (string-match "^file:" desc) (setq desc (substring desc (match-end 0))))) (setq desc (org-add-props - (concat "\""") '(org-protected t)))) (cond diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el index 054ccb0730..d5f17b2cb6 100644 --- a/lisp/org/org-indent.el +++ b/lisp/org/org-indent.el @@ -159,69 +159,68 @@ properties, after each buffer modification, on the modified zone. The process is synchronous. Though, initial indentation of buffer, which can take a few seconds on large buffers, is done -during idle time." nil " Ind" nil -(cond - ((org-bound-and-true-p org-inhibit-startup) - (setq org-indent-mode nil)) - ((and org-indent-mode (featurep 'xemacs)) - (message "org-indent-mode does not work in XEmacs - refusing to turn it on") - (setq org-indent-mode nil)) - ((and org-indent-mode - (not (org-version-check "23.1.50" "Org Indent mode" :predicate))) - (message "org-indent-mode can crash Emacs 23.1 - refusing to turn it on!") - (ding) - (sit-for 1) - (setq org-indent-mode nil)) - (org-indent-mode - ;; mode was turned on. - (org-set-local 'indent-tabs-mode nil) - (or org-indent-strings (org-indent-initialize)) - (org-set-local 'org-indent-initial-marker (copy-marker 1)) - (when org-indent-mode-turns-off-org-adapt-indentation - (org-set-local 'org-adapt-indentation nil)) - (when org-indent-mode-turns-on-hiding-stars - (org-set-local 'org-hide-leading-stars-before-indent-mode - org-hide-leading-stars) - (org-set-local 'org-hide-leading-stars t)) - (make-local-variable 'filter-buffer-substring-functions) - (add-hook 'filter-buffer-substring-functions - (lambda (fun start end delete) - (org-indent-remove-properties-from-string - (funcall fun start end delete)))) - (org-add-hook 'after-change-functions 'org-indent-refresh-maybe nil 'local) - (org-add-hook 'before-change-functions - 'org-indent-notify-modified-headline nil 'local) - (and font-lock-mode (org-restart-font-lock)) - (org-indent-remove-properties (point-min) (point-max)) - ;; Submit current buffer to initialize agent. If it's the first - ;; buffer submitted, also start the agent. Current buffer is - ;; pushed in both cases to avoid a race condition. - (if org-indent-agentized-buffers +during idle time." + nil " Ind" nil + (cond + ((and org-indent-mode (featurep 'xemacs)) + (message "org-indent-mode does not work in XEmacs - refusing to turn it on") + (setq org-indent-mode nil)) + ((and org-indent-mode + (not (org-version-check "23.1.50" "Org Indent mode" :predicate))) + (message "org-indent-mode can crash Emacs 23.1 - refusing to turn it on!") + (ding) + (sit-for 1) + (setq org-indent-mode nil)) + (org-indent-mode + ;; mode was turned on. + (org-set-local 'indent-tabs-mode nil) + (or org-indent-strings (org-indent-initialize)) + (org-set-local 'org-indent-initial-marker (copy-marker 1)) + (when org-indent-mode-turns-off-org-adapt-indentation + (org-set-local 'org-adapt-indentation nil)) + (when org-indent-mode-turns-on-hiding-stars + (org-set-local 'org-hide-leading-stars-before-indent-mode + org-hide-leading-stars) + (org-set-local 'org-hide-leading-stars t)) + (make-local-variable 'filter-buffer-substring-functions) + (add-hook 'filter-buffer-substring-functions + (lambda (fun start end delete) + (org-indent-remove-properties-from-string + (funcall fun start end delete)))) + (org-add-hook 'after-change-functions 'org-indent-refresh-maybe nil 'local) + (org-add-hook 'before-change-functions + 'org-indent-notify-modified-headline nil 'local) + (and font-lock-mode (org-restart-font-lock)) + (org-indent-remove-properties (point-min) (point-max)) + ;; Submit current buffer to initialize agent. If it's the first + ;; buffer submitted, also start the agent. Current buffer is + ;; pushed in both cases to avoid a race condition. + (if org-indent-agentized-buffers + (push (current-buffer) org-indent-agentized-buffers) (push (current-buffer) org-indent-agentized-buffers) - (push (current-buffer) org-indent-agentized-buffers) - (setq org-indent-agent-timer - (run-with-idle-timer 0.2 t #'org-indent-initialize-agent)))) - (t - ;; mode was turned off (or we refused to turn it on) - (kill-local-variable 'org-adapt-indentation) - (setq org-indent-agentized-buffers - (delq (current-buffer) org-indent-agentized-buffers)) - (when (markerp org-indent-initial-marker) - (set-marker org-indent-initial-marker nil)) - (when (boundp 'org-hide-leading-stars-before-indent-mode) - (org-set-local 'org-hide-leading-stars - org-hide-leading-stars-before-indent-mode)) - (remove-hook 'filter-buffer-substring-functions - (lambda (fun start end delete) - (org-indent-remove-properties-from-string - (funcall fun start end delete)))) - (remove-hook 'after-change-functions 'org-indent-refresh-maybe 'local) - (remove-hook 'before-change-functions - 'org-indent-notify-modified-headline 'local) - (org-with-wide-buffer - (org-indent-remove-properties (point-min) (point-max))) - (and font-lock-mode (org-restart-font-lock)) - (redraw-display)))) + (setq org-indent-agent-timer + (run-with-idle-timer 0.2 t #'org-indent-initialize-agent)))) + (t + ;; mode was turned off (or we refused to turn it on) + (kill-local-variable 'org-adapt-indentation) + (setq org-indent-agentized-buffers + (delq (current-buffer) org-indent-agentized-buffers)) + (when (markerp org-indent-initial-marker) + (set-marker org-indent-initial-marker nil)) + (when (boundp 'org-hide-leading-stars-before-indent-mode) + (org-set-local 'org-hide-leading-stars + org-hide-leading-stars-before-indent-mode)) + (remove-hook 'filter-buffer-substring-functions + (lambda (fun start end delete) + (org-indent-remove-properties-from-string + (funcall fun start end delete)))) + (remove-hook 'after-change-functions 'org-indent-refresh-maybe 'local) + (remove-hook 'before-change-functions + 'org-indent-notify-modified-headline 'local) + (org-with-wide-buffer + (org-indent-remove-properties (point-min) (point-max))) + (and font-lock-mode (org-restart-font-lock)) + (redraw-display)))) (defun org-indent-indent-buffer () "Add indentation properties to the accessible part of the buffer." diff --git a/lisp/org/org-install.el b/lisp/org/org-install.el index aca019fb82..5835959736 100644 --- a/lisp/org/org-install.el +++ b/lisp/org/org-install.el @@ -1,10 +1,12 @@ ;;; org-install.el --- backward compatibility file for obsolete configuration ;; ;;; Code: -(warn "The file org-install is obsolete. -It is provided here so that (require 'org-install) does not -trigger an error for users with obsolete Emacs configuration. -You can safely remove (require 'org-install) from your config.") +;; +;; The file org-install is obsolete. +;; +;; It is provided here so that (require 'org-install) does not +;; trigger an error for users with obsolete Emacs configuration. +;; You can safely remove (require 'org-install) from your config." (provide 'org-install) diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el index 78cb2a621c..4747648162 100644 --- a/lisp/org/org-list.el +++ b/lisp/org/org-list.el @@ -1802,7 +1802,9 @@ This function modifies STRUCT." ;; There are boxes checked after an unchecked one: fix that. (when (member "[X]" after-unchecked) (let ((index (- (length struct) (length after-unchecked)))) - (mapc (lambda (e) (org-list-set-checkbox e struct "[ ]")) + (mapc (lambda (e) + (when (org-list-get-checkbox e struct) + (org-list-set-checkbox e struct "[ ]"))) (nthcdr index all-items)) ;; Verify once again the structure, without ORDERED. (org-list-struct-fix-box struct parents prevs nil) diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el index a44bdbe30f..ceee30601b 100644 --- a/lisp/org/org-macs.el +++ b/lisp/org/org-macs.el @@ -93,7 +93,7 @@ Also, do not record undo information." `(set-buffer-modified-p (prog1 (buffer-modified-p) (let ((buffer-undo-list t) - before-change-functions after-change-functions) + (inhibit-modification-hooks t)) ,@body)))) (def-edebug-spec org-unmodified (body)) diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index e62eba3cf8..1910d3f7b4 100644 --- a/lisp/org/org-version.el +++ b/lisp/org/org-version.el @@ -5,13 +5,13 @@ (defun org-release () "The release version of org-mode. Inserted by installing org-mode or when a release is made." - (let ((org-release "7.9.3d")) + (let ((org-release "7.9.3e")) org-release)) ;;;###autoload (defun org-git-version () "The Git version of org-mode. Inserted by installing org-mode or when a release is made." - (let ((org-git-version "7.9.3d-GNU-Emacs-24-3 (commit e8f5b0ad)")) + (let ((org-git-version "7.9.3e-3-gb07a9b")) org-git-version)) ;;;###autoload (defvar org-odt-data-dir "/usr/share/emacs/etc/org" diff --git a/lisp/org/org.el b/lisp/org/org.el index 9409feca17..bba52a8b63 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -4915,6 +4915,7 @@ The following commands are available: (org-set-local 'calc-embedded-open-mode "# ") (modify-syntax-entry ?@ "w") (if org-startup-truncated (setq truncate-lines t)) + (when org-startup-indented (require 'org-indent) (org-indent-mode 1)) (org-set-local 'font-lock-unfontify-region-function 'org-unfontify-region) ;; Activate before-change-function @@ -4970,9 +4971,6 @@ The following commands are available: (org-set-local 'outline-isearch-open-invisible-function (lambda (&rest ignore) (org-show-context 'isearch)))) - ;; Turn on org-beamer-mode? - (and org-startup-with-beamer-mode (org-beamer-mode)) - ;; Setup the pcomplete hooks (set (make-local-variable 'pcomplete-command-completion-function) 'org-pcomplete-initial) @@ -4992,15 +4990,13 @@ The following commands are available: (= (point-min) (point-max))) (insert "# -*- mode: org -*-\n\n")) (unless org-inhibit-startup + (and org-startup-with-beamer-mode (org-beamer-mode)) (when org-startup-align-all-tables (let ((bmp (buffer-modified-p))) (org-table-map-tables 'org-table-align 'quietly) (set-buffer-modified-p bmp))) (when org-startup-with-inline-images (org-display-inline-images)) - (when org-startup-indented - (require 'org-indent) - (org-indent-mode 1)) (unless org-inhibit-startup-visibility-stuff (org-set-startup-visibility))) ;; Try to set org-hide correctly @@ -5422,7 +5418,7 @@ by a #." '(font-lock-fontified t invisible t) '(font-lock-fontified t face org-document-info-keyword))) (add-text-properties - (match-beginning 6) (1+ (match-end 6)) + (match-beginning 6) (min (point-max) (1+ (match-end 6))) (if (string-equal dc1 "+title:") '(font-lock-fontified t face org-document-title) '(font-lock-fontified t face org-document-info)))) @@ -15925,7 +15921,8 @@ Don't touch the rest." (floor (* (string-to-number (match-string 1 ts)) (cdr (assoc (match-string 2 ts) '(("d" . 1) ("w" . 7) - ("m" . 30.4) ("y" . 365.25))))))) + ("m" . 30.4) ("y" . 365.25) + ("h" . 0.041667))))))) ;; go for the default. (t org-deadline-warning-days))) @@ -16662,6 +16659,15 @@ effort string \"2hours\" is equivalent to 120 minutes." :type '(alist :key-type (string :tag "Modifier") :value-type (number :tag "Minutes"))) +(defcustom org-agenda-inhibit-startup t + "Inhibit startup when preparing agenda buffers. +When this variable is `t' (the default), the initialization of +the Org agenda buffers is inhibited: e.g. the visibility state +is not set, the tables are not re-aligned, etc." + :type 'boolean + :version "24.3" + :group 'org-agenda) + (defun org-duration-string-to-minutes (s &optional output-to-string) "Convert a duration string S to minutes. @@ -17001,6 +17007,7 @@ When a buffer is unmodified, it is just killed. When modified, it is saved (pc '(:org-comment t)) (pall '(:org-archived t :org-comment t)) (inhibit-read-only t) + (org-inhibit-startup org-agenda-inhibit-startup) (rea (concat ":" org-archive-tag ":")) bmp file re) (save-excursion @@ -20984,58 +20991,62 @@ hierarchy of headlines by UP levels before marking the subtree." (declare-function message-in-body-p "message" ()) (defvar org-element--affiliated-re) ; From org-element.el +(defvar orgtbl-line-start-regexp) ; From org-table.el (defun org-adaptive-fill-function () "Compute a fill prefix for the current line. Return fill prefix, as a string, or nil if current line isn't meant to be filled." (let (prefix) - (when (and (derived-mode-p 'message-mode) (message-in-body-p)) - (save-excursion - (beginning-of-line) - (cond ((looking-at message-cite-prefix-regexp) - (setq prefix (match-string-no-properties 0))) - ((looking-at org-outline-regexp) - (setq prefix ""))))) - (or prefix - (org-with-wide-buffer - (let* ((p (line-beginning-position)) - (element (save-excursion (beginning-of-line) (org-element-at-point))) - (type (org-element-type element)) - (post-affiliated - (save-excursion - (goto-char (org-element-property :begin element)) - (while (looking-at org-element--affiliated-re) (forward-line)) - (point)))) - (unless (< p post-affiliated) - (case type - (comment (looking-at "[ \t]*# ?") (match-string 0)) - (footnote-definition "") - ((item plain-list) - (make-string (org-list-item-body-column post-affiliated) ? )) - (paragraph - ;; Fill prefix is usually the same as the current line, - ;; except if the paragraph is at the beginning of an item. - (let ((parent (org-element-property :parent element))) - (cond ((eq (org-element-type parent) 'item) - (make-string (org-list-item-body-column - (org-element-property :begin parent)) - ? )) - ((save-excursion (beginning-of-line) (looking-at "[ \t]+")) - (match-string 0)) - (t "")))) - (comment-block - ;; Only fill contents if P is within block boundaries. - (let* ((cbeg (save-excursion (goto-char post-affiliated) - (forward-line) - (point))) - (cend (save-excursion - (goto-char (org-element-property :end element)) - (skip-chars-backward " \r\t\n") - (line-beginning-position)))) - (when (and (>= p cbeg) (< p cend)) - (if (save-excursion (beginning-of-line) (looking-at "[ \t]+")) - (match-string 0) - ""))))))))))) + (catch 'exit + (when (derived-mode-p 'message-mode) + (save-excursion + (beginning-of-line) + (cond ((or (not (message-in-body-p)) + (looking-at orgtbl-line-start-regexp)) + (throw 'exit nil)) + ((looking-at message-cite-prefix-regexp) + (throw 'exit (match-string-no-properties 0))) + ((looking-at org-outline-regexp) + (throw 'exit (make-string (length (match-string 0)) ? )))))) + (org-with-wide-buffer + (let* ((p (line-beginning-position)) + (element (save-excursion (beginning-of-line) (org-element-at-point))) + (type (org-element-type element)) + (post-affiliated + (save-excursion + (goto-char (org-element-property :begin element)) + (while (looking-at org-element--affiliated-re) (forward-line)) + (point)))) + (unless (< p post-affiliated) + (case type + (comment (looking-at "[ \t]*# ?") (match-string 0)) + (footnote-definition "") + ((item plain-list) + (make-string (org-list-item-body-column post-affiliated) ? )) + (paragraph + ;; Fill prefix is usually the same as the current line, + ;; except if the paragraph is at the beginning of an item. + (let ((parent (org-element-property :parent element))) + (cond ((eq (org-element-type parent) 'item) + (make-string (org-list-item-body-column + (org-element-property :begin parent)) + ? )) + ((save-excursion (beginning-of-line) (looking-at "[ \t]+")) + (match-string 0)) + (t "")))) + (comment-block + ;; Only fill contents if P is within block boundaries. + (let* ((cbeg (save-excursion (goto-char post-affiliated) + (forward-line) + (point))) + (cend (save-excursion + (goto-char (org-element-property :end element)) + (skip-chars-backward " \r\t\n") + (line-beginning-position)))) + (when (and (>= p cbeg) (< p cend)) + (if (save-excursion (beginning-of-line) (looking-at "[ \t]+")) + (match-string 0) + ""))))))))))) (declare-function message-goto-body "message" ()) (defvar message-cite-prefix-regexp) ; From message.el