|
@@ -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."
|