浏览代码

Alan E Davis writes:

>  Feature Request: that the pdf saved automatically from agenda be
>  immediately displayed
>  The saving of a pdf is a really nice feature.  I had hacked
>  org-agenda, I think, to automatically do this.  However, it would
>  be nicer if immediate display were optional.  I don't know
>  whether \C-u makes sense as a prefix to saving a file with \C-x
>  \C-w.  Perhaps not.

Why not, C-c C-x C-w is a fine idea for this.  It should now work.
Carsten Dominik 16 年之前
父节点
当前提交
ae2cf50782
共有 2 个文件被更改,包括 12 次插入8 次删除
  1. 5 4
      doc/org.texi
  2. 7 4
      lisp/org-agenda.el

+ 5 - 4
doc/org.texi

@@ -6949,10 +6949,11 @@ This is a globally available command, and also available in the agenda menu.
 @vindex org-agenda-exporter-settings
 Write the agenda view to a file.  Depending on the extension of the selected
 file name, the view will be exported as HTML (extension @file{.html} or
-@file{.htm}), Postscript (extension @file{.ps}), PDF
-(extension @file{.pdf}), or plain text (any other extension).  Use the
-variable @code{org-agenda-exporter-settings} to set options for
-@file{ps-print} and for @file{htmlize} to be used during export.
+@file{.htm}), Postscript (extension @file{.ps}), PDF (extension @file{.pdf}),
+or plain text (any other extension).  When called with a @kbd{C-u} prefix
+argument, immediately open the newly created file.  Use the variable
+@code{org-agenda-exporter-settings} to set options for @file{ps-print} and
+for @file{htmlize} to be used during export.
 
 @tsubheading{Quit and Exit}
 @kindex q

+ 7 - 4
lisp/org-agenda.el

@@ -2007,22 +2007,23 @@ so the export commands can easily use it."
 	  (while files
 	    (eval (list 'let (append org-agenda-exporter-settings opts pars)
 			(list 'org-write-agenda
-			      (expand-file-name (pop files) dir) t))))
+			      (expand-file-name (pop files) dir) nil t))))
 	  (and (get-buffer org-agenda-buffer-name)
 	       (kill-buffer org-agenda-buffer-name)))))))
 
-(defun org-write-agenda (file &optional nosettings)
+(defun org-write-agenda (file &optional open nosettings)
   "Write the current buffer (an agenda view) as a file.
 Depending on the extension of the file name, plain text (.txt),
 HTML (.html or .htm) or Postscript (.ps) is produced.
 If the extension is .ics, run icalendar export over all files used
 to construct the agenda and limit the export to entries listed in the
 agenda now.
+With prefic argument OPEN, open the new file immediately.
 If NOSETTINGS is given, do not scope the settings of
 `org-agenda-exporter-settings' into the export commands.  This is used when
 the settings have already been scoped and we do not wish to overrule other,
 higher priority settings."
-  (interactive "FWrite agenda to file: ")
+  (interactive "FWrite agenda to file: \nP")
   (if (not (file-writable-p file))
       (error "Cannot write agenda to file %s" file))
   (cond
@@ -2088,7 +2089,9 @@ higher priority settings."
 		 (save-buffer 0)
 		 (kill-buffer (current-buffer))
 		 (message "Plain text written to %s" file))))))))
-    (set-buffer org-agenda-buffer-name)))
+    (set-buffer org-agenda-buffer-name))
+  (when open (org-open-file file)))
+
 (defvar org-agenda-filter-overlays nil)
 
 (defun org-agenda-mark-filtered-text ()