mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-12-29 11:02:33 +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
|
set options for @file{ps-print} and for @file{htmlize} to be used during
|
||||||
export, for example
|
export, for example
|
||||||
|
|
||||||
|
@vindex org-agenda-add-entry-text-maxlines
|
||||||
|
@vindex htmlize-output-type
|
||||||
|
@vindex ps-number-of-columns
|
||||||
|
@vindex ps-landscape-mode
|
||||||
@lisp
|
@lisp
|
||||||
(setq org-agenda-exporter-settings
|
(setq org-agenda-exporter-settings
|
||||||
'((ps-number-of-columns 2)
|
'((ps-number-of-columns 2)
|
||||||
(ps-landscape-mode t)
|
(ps-landscape-mode t)
|
||||||
(org-agenda-before-write-hook
|
|
||||||
'(org-agenda-add-entry-text))
|
|
||||||
(org-agenda-add-entry-text-maxlines 5)
|
(org-agenda-add-entry-text-maxlines 5)
|
||||||
(htmlize-output-type 'css)))
|
(htmlize-output-type 'css)))
|
||||||
@end lisp
|
@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
|
the layout relative to the first line. Should there be lines with less
|
||||||
indentation than the first, these are left alone.
|
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
|
@node HTML export, LaTeX and PDF export, ASCII export, Exporting
|
||||||
@section HTML export
|
@section HTML export
|
||||||
@cindex HTML export
|
@cindex HTML export
|
||||||
|
@ -109,17 +109,20 @@ This is a good place to set options for ps-print and for htmlize."
|
|||||||
(variable)
|
(variable)
|
||||||
(sexp :tag "Value"))))
|
(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.
|
"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
|
:group 'org-agenda-export
|
||||||
:type 'hook
|
:type 'hook
|
||||||
:options '(org-agenda-add-entry-text))
|
: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.
|
"Maximum number of entry text lines to be added to agenda.
|
||||||
This is only relevant when `org-agenda-add-entry-text'
|
This is only relevant when `org-agenda-add-entry-text' is part of
|
||||||
has beed added to `org-agenda-before-write-hook'."
|
`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
|
:group 'org-agenda
|
||||||
:type 'integer)
|
: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
|
This will add a maximum of `org-agenda-add-entry-text-maxlines' lines of the
|
||||||
entry text following headings shown in the agenda.
|
entry text following headings shown in the agenda.
|
||||||
Drawers will be excluded, also the line with scheduling/deadline info."
|
Drawers will be excluded, also the line with scheduling/deadline info."
|
||||||
(let (m txt drawer-re kwd-time-re ind)
|
(when (> org-agenda-add-entry-text-maxlines 0)
|
||||||
(goto-char (point-min))
|
(let (m txt drawer-re kwd-time-re ind)
|
||||||
(while (not (eobp))
|
(goto-char (point-min))
|
||||||
(if (not (setq m (get-text-property (point) 'org-hd-marker)))
|
(while (not (eobp))
|
||||||
(beginning-of-line 2)
|
(if (not (setq m (get-text-property (point) 'org-hd-marker)))
|
||||||
(save-excursion
|
(beginning-of-line 2)
|
||||||
(with-current-buffer (marker-buffer m)
|
(save-excursion
|
||||||
(if (not (org-mode-p))
|
(with-current-buffer (marker-buffer m)
|
||||||
(setq txt "")
|
(if (not (org-mode-p))
|
||||||
(save-excursion
|
(setq txt "")
|
||||||
(save-restriction
|
(save-excursion
|
||||||
(widen)
|
(save-restriction
|
||||||
(goto-char m)
|
(widen)
|
||||||
(beginning-of-line 2)
|
(goto-char m)
|
||||||
(setq txt (buffer-substring (point)
|
(beginning-of-line 2)
|
||||||
(progn
|
(setq txt (buffer-substring
|
||||||
(outline-next-heading) (point)))
|
(point)
|
||||||
drawer-re org-drawer-regexp
|
(progn (outline-next-heading) (point)))
|
||||||
kwd-time-re (concat "^[ \t]*" org-keyword-time-regexp
|
drawer-re org-drawer-regexp
|
||||||
".*\n?"))
|
kwd-time-re (concat "^[ \t]*" org-keyword-time-regexp
|
||||||
(with-temp-buffer
|
".*\n?"))
|
||||||
(insert txt)
|
(with-temp-buffer
|
||||||
(goto-char (point-min))
|
(insert txt)
|
||||||
(while (re-search-forward drawer-re nil t)
|
(goto-char (point-min))
|
||||||
(delete-region
|
(while (re-search-forward drawer-re nil t)
|
||||||
(match-beginning 0)
|
(delete-region
|
||||||
(progn (re-search-forward "^[ \t]*:END:.*\n?" nil 'move)
|
(match-beginning 0)
|
||||||
(point))))
|
(progn (re-search-forward
|
||||||
(goto-char (point-min))
|
"^[ \t]*:END:.*\n?" nil 'move)
|
||||||
(while (re-search-forward kwd-time-re nil t)
|
(point))))
|
||||||
(replace-match ""))
|
(goto-char (point-min))
|
||||||
(if (re-search-forward "[ \t\n]+\\'" nil t)
|
(while (re-search-forward kwd-time-re nil t)
|
||||||
(replace-match ""))
|
(replace-match ""))
|
||||||
(goto-char (point-min))
|
(if (re-search-forward "[ \t\n]+\\'" nil t)
|
||||||
;; find min indentation
|
(replace-match ""))
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(untabify (point-min) (point-max))
|
;; find min indentation
|
||||||
(setq ind (org-get-indentation))
|
(goto-char (point-min))
|
||||||
(while (not (eobp))
|
(untabify (point-min) (point-max))
|
||||||
(unless (looking-at "[ \t]*$")
|
(setq ind (org-get-indentation))
|
||||||
(setq ind (min ind (org-get-indentation))))
|
(while (not (eobp))
|
||||||
(beginning-of-line 2))
|
(unless (looking-at "[ \t]*$")
|
||||||
(goto-char (point-min))
|
(setq ind (min ind (org-get-indentation))))
|
||||||
(while (not (eobp))
|
(beginning-of-line 2))
|
||||||
(unless (looking-at "[ \t]*$")
|
(goto-char (point-min))
|
||||||
(move-to-column ind)
|
(while (not (eobp))
|
||||||
(delete-region (point-at-bol) (point)))
|
(unless (looking-at "[ \t]*$")
|
||||||
(beginning-of-line 2))
|
(move-to-column ind)
|
||||||
(goto-char (point-min))
|
(delete-region (point-at-bol) (point)))
|
||||||
(while (and (not (eobp)) (re-search-forward "^" nil t))
|
(beginning-of-line 2))
|
||||||
(replace-match " > "))
|
(goto-char (point-min))
|
||||||
(goto-char (point-min))
|
(while (and (not (eobp)) (re-search-forward "^" nil t))
|
||||||
(while (looking-at "[ \t]*\n") (replace-match ""))
|
(replace-match " > "))
|
||||||
(goto-char (point-max))
|
(goto-char (point-min))
|
||||||
(when (> (org-current-line)
|
(while (looking-at "[ \t]*\n") (replace-match ""))
|
||||||
(1+ org-agenda-add-entry-text-maxlines))
|
(goto-char (point-max))
|
||||||
(goto-line (1+ org-agenda-add-entry-text-maxlines))
|
(when (> (org-current-line)
|
||||||
(backward-char 1))
|
(1+ org-agenda-add-entry-text-maxlines))
|
||||||
(setq txt (buffer-substring (point-min) (point)))))))))
|
(goto-line (1+ org-agenda-add-entry-text-maxlines))
|
||||||
(end-of-line 1)
|
(backward-char 1))
|
||||||
(if (string-match "\\S-" txt) (insert "\n" txt))))))
|
(setq txt (buffer-substring (point-min) (point)))))))))
|
||||||
|
(end-of-line 1)
|
||||||
|
(if (string-match "\\S-" txt) (insert "\n" txt)))))))
|
||||||
|
|
||||||
(defun org-agenda-collect-markers ()
|
(defun org-agenda-collect-markers ()
|
||||||
"Collect the markers pointing to entries in the agenda buffer."
|
"Collect the markers pointing to entries in the agenda buffer."
|
||||||
|
Loading…
Reference in New Issue
Block a user