mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-12-28 10:56:57 +00:00
Agenda views: Simplify setting up inclusion of entry text
This commit is contained in:
parent
75ba44f877
commit
8cdc0cc961
11
doc/org.texi
11
doc/org.texi
@ -7082,12 +7082,14 @@ Use the variable @code{org-agenda-exporter-settings} to
|
||||
set options for @file{ps-print} and for @file{htmlize} to be used during
|
||||
export, for example
|
||||
|
||||
@vindex org-agenda-add-entry-text-maxlines
|
||||
@vindex htmlize-output-type
|
||||
@vindex ps-number-of-columns
|
||||
@vindex ps-landscape-mode
|
||||
@lisp
|
||||
(setq org-agenda-exporter-settings
|
||||
'((ps-number-of-columns 2)
|
||||
(ps-landscape-mode t)
|
||||
(org-agenda-before-write-hook
|
||||
'(org-agenda-add-entry-text))
|
||||
(org-agenda-add-entry-text-maxlines 5)
|
||||
(htmlize-output-type 'css)))
|
||||
@end lisp
|
||||
@ -8208,6 +8210,11 @@ the body text. Any indentation larger than this is adjusted to preserve
|
||||
the layout relative to the first line. Should there be lines with less
|
||||
indentation than the first, these are left alone.
|
||||
|
||||
@vindex org-export-ascii-links-to-notes
|
||||
Links will be exported in a footnote-like style, with the descriptive part in
|
||||
the text and the link in a note before the next heading. See the variable
|
||||
@code{org-export-ascii-links-to-notes} for details and other options.
|
||||
|
||||
@node HTML export, LaTeX and PDF export, ASCII export, Exporting
|
||||
@section HTML export
|
||||
@cindex HTML export
|
||||
|
@ -109,17 +109,20 @@ This is a good place to set options for ps-print and for htmlize."
|
||||
(variable)
|
||||
(sexp :tag "Value"))))
|
||||
|
||||
(defcustom org-agenda-before-write-hook nil
|
||||
(defcustom org-agenda-before-write-hook '(org-agenda-add-entry-text)
|
||||
"Hook run in temporary buffer before writing it to an export file.
|
||||
A useful function would be `org-agenda-add-entry-text'."
|
||||
A useful function is `org-agenda-add-entry-text'."
|
||||
:group 'org-agenda-export
|
||||
:type 'hook
|
||||
:options '(org-agenda-add-entry-text))
|
||||
|
||||
(defcustom org-agenda-add-entry-text-maxlines 10
|
||||
(defcustom org-agenda-add-entry-text-maxlines 0
|
||||
"Maximum number of entry text lines to be added to agenda.
|
||||
This is only relevant when `org-agenda-add-entry-text'
|
||||
has beed added to `org-agenda-before-write-hook'."
|
||||
This is only relevant when `org-agenda-add-entry-text' is part of
|
||||
`org-agenda-before-write-hook', which it is by default.
|
||||
When this is 0, nothing will happen. When it is greater than 0, it
|
||||
specifies the maximum number of lines that will be added for each entry
|
||||
that is listed in the agenda view."
|
||||
:group 'org-agenda
|
||||
:type 'integer)
|
||||
|
||||
@ -2090,67 +2093,69 @@ VALUE defaults to t."
|
||||
This will add a maximum of `org-agenda-add-entry-text-maxlines' lines of the
|
||||
entry text following headings shown in the agenda.
|
||||
Drawers will be excluded, also the line with scheduling/deadline info."
|
||||
(let (m txt drawer-re kwd-time-re ind)
|
||||
(goto-char (point-min))
|
||||
(while (not (eobp))
|
||||
(if (not (setq m (get-text-property (point) 'org-hd-marker)))
|
||||
(beginning-of-line 2)
|
||||
(save-excursion
|
||||
(with-current-buffer (marker-buffer m)
|
||||
(if (not (org-mode-p))
|
||||
(setq txt "")
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(goto-char m)
|
||||
(beginning-of-line 2)
|
||||
(setq txt (buffer-substring (point)
|
||||
(progn
|
||||
(outline-next-heading) (point)))
|
||||
drawer-re org-drawer-regexp
|
||||
kwd-time-re (concat "^[ \t]*" org-keyword-time-regexp
|
||||
".*\n?"))
|
||||
(with-temp-buffer
|
||||
(insert txt)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward drawer-re nil t)
|
||||
(delete-region
|
||||
(match-beginning 0)
|
||||
(progn (re-search-forward "^[ \t]*:END:.*\n?" nil 'move)
|
||||
(point))))
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward kwd-time-re nil t)
|
||||
(replace-match ""))
|
||||
(if (re-search-forward "[ \t\n]+\\'" nil t)
|
||||
(when (> org-agenda-add-entry-text-maxlines 0)
|
||||
(let (m txt drawer-re kwd-time-re ind)
|
||||
(goto-char (point-min))
|
||||
(while (not (eobp))
|
||||
(if (not (setq m (get-text-property (point) 'org-hd-marker)))
|
||||
(beginning-of-line 2)
|
||||
(save-excursion
|
||||
(with-current-buffer (marker-buffer m)
|
||||
(if (not (org-mode-p))
|
||||
(setq txt "")
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(goto-char m)
|
||||
(beginning-of-line 2)
|
||||
(setq txt (buffer-substring
|
||||
(point)
|
||||
(progn (outline-next-heading) (point)))
|
||||
drawer-re org-drawer-regexp
|
||||
kwd-time-re (concat "^[ \t]*" org-keyword-time-regexp
|
||||
".*\n?"))
|
||||
(with-temp-buffer
|
||||
(insert txt)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward drawer-re nil t)
|
||||
(delete-region
|
||||
(match-beginning 0)
|
||||
(progn (re-search-forward
|
||||
"^[ \t]*:END:.*\n?" nil 'move)
|
||||
(point))))
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward kwd-time-re nil t)
|
||||
(replace-match ""))
|
||||
(goto-char (point-min))
|
||||
;; find min indentation
|
||||
(goto-char (point-min))
|
||||
(untabify (point-min) (point-max))
|
||||
(setq ind (org-get-indentation))
|
||||
(while (not (eobp))
|
||||
(unless (looking-at "[ \t]*$")
|
||||
(setq ind (min ind (org-get-indentation))))
|
||||
(beginning-of-line 2))
|
||||
(goto-char (point-min))
|
||||
(while (not (eobp))
|
||||
(unless (looking-at "[ \t]*$")
|
||||
(move-to-column ind)
|
||||
(delete-region (point-at-bol) (point)))
|
||||
(beginning-of-line 2))
|
||||
(goto-char (point-min))
|
||||
(while (and (not (eobp)) (re-search-forward "^" nil t))
|
||||
(replace-match " > "))
|
||||
(goto-char (point-min))
|
||||
(while (looking-at "[ \t]*\n") (replace-match ""))
|
||||
(goto-char (point-max))
|
||||
(when (> (org-current-line)
|
||||
(1+ org-agenda-add-entry-text-maxlines))
|
||||
(goto-line (1+ org-agenda-add-entry-text-maxlines))
|
||||
(backward-char 1))
|
||||
(setq txt (buffer-substring (point-min) (point)))))))))
|
||||
(end-of-line 1)
|
||||
(if (string-match "\\S-" txt) (insert "\n" txt))))))
|
||||
(if (re-search-forward "[ \t\n]+\\'" nil t)
|
||||
(replace-match ""))
|
||||
(goto-char (point-min))
|
||||
;; find min indentation
|
||||
(goto-char (point-min))
|
||||
(untabify (point-min) (point-max))
|
||||
(setq ind (org-get-indentation))
|
||||
(while (not (eobp))
|
||||
(unless (looking-at "[ \t]*$")
|
||||
(setq ind (min ind (org-get-indentation))))
|
||||
(beginning-of-line 2))
|
||||
(goto-char (point-min))
|
||||
(while (not (eobp))
|
||||
(unless (looking-at "[ \t]*$")
|
||||
(move-to-column ind)
|
||||
(delete-region (point-at-bol) (point)))
|
||||
(beginning-of-line 2))
|
||||
(goto-char (point-min))
|
||||
(while (and (not (eobp)) (re-search-forward "^" nil t))
|
||||
(replace-match " > "))
|
||||
(goto-char (point-min))
|
||||
(while (looking-at "[ \t]*\n") (replace-match ""))
|
||||
(goto-char (point-max))
|
||||
(when (> (org-current-line)
|
||||
(1+ org-agenda-add-entry-text-maxlines))
|
||||
(goto-line (1+ org-agenda-add-entry-text-maxlines))
|
||||
(backward-char 1))
|
||||
(setq txt (buffer-substring (point-min) (point)))))))))
|
||||
(end-of-line 1)
|
||||
(if (string-match "\\S-" txt) (insert "\n" txt)))))))
|
||||
|
||||
(defun org-agenda-collect-markers ()
|
||||
"Collect the markers pointing to entries in the agenda buffer."
|
||||
|
Loading…
Reference in New Issue
Block a user