aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2011-01-03 20:47:39 -0800
committerGlenn Morris2011-01-03 20:47:39 -0800
commitef4271fe82c076b0c259df267371e747339aa669 (patch)
treec4aa4b99fa6c874616c5242c1896dd1ed591e088
parent3f9b70909a68e40e54f199542065e79df6d6eb04 (diff)
downloademacs-ef4271fe82c076b0c259df267371e747339aa669.tar.gz
emacs-ef4271fe82c076b0c259df267371e747339aa669.zip
Small rst.el stuff.
* lisp/textmodes/rst.el (rst-compile-toolsets): Make it a defcustom. Add `pdf' and `s5' entries. Use `prog.py' if found, otherwise default to `prog' without a .py extension. (rst-compile-pdf-preview, rst-compile-slides-preview): Use program names from rst-compile-toolsets, rather than hard-coding. (rst-portable-mark-active-p): Fix presumed typo.
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/textmodes/rst.el49
2 files changed, 46 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d199e0ca100..66c5d1839ed 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12011-01-04 Glenn Morris <rgm@gnu.org>
2
3 * textmodes/rst.el (rst-compile-toolsets): Make it a defcustom.
4 Add `pdf' and `s5' entries. Use `prog.py' if found, otherwise
5 default to `prog' without a .py extension.
6 (rst-compile-pdf-preview, rst-compile-slides-preview):
7 Use program names from rst-compile-toolsets, rather than hard-coding.
8 (rst-portable-mark-active-p): Fix presumed typo.
9
12011-01-02 Eli Zaretskii <eliz@gnu.org> 102011-01-02 Eli Zaretskii <eliz@gnu.org>
2 11
3 * term/w32-win.el (dynamic-library-alist): Set up correctly for 12 * term/w32-win.el (dynamic-library-alist): Set up correctly for
diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el
index 067fa3a06d7..bbeab60bfd6 100644
--- a/lisp/textmodes/rst.el
+++ b/lisp/textmodes/rst.el
@@ -1,6 +1,6 @@
1;;; rst.el --- Mode for viewing and editing reStructuredText-documents. 1;;; rst.el --- Mode for viewing and editing reStructuredText-documents.
2 2
3;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 3;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
4;; Free Software Foundation, Inc. 4;; Free Software Foundation, Inc.
5 5
6;; Authors: Martin Blais <blais@furius.ca>, 6;; Authors: Martin Blais <blais@furius.ca>,
@@ -3234,16 +3234,37 @@ document with \\[rst-compile]."
3234 :group 'rst 3234 :group 'rst
3235 :version "21.1") 3235 :version "21.1")
3236 3236
3237(defvar rst-compile-toolsets 3237(defcustom rst-compile-toolsets
3238 '((html . ("rst2html.py" ".html" nil)) 3238 `((html ,(if (executable-find "rst2html.py") "rst2html.py" "rst2html")
3239 (latex . ("rst2latex.py" ".tex" nil)) 3239 ".html" nil)
3240 (newlatex . ("rst2newlatex.py" ".tex" nil)) 3240 (latex ,(if (executable-find "rst2latex.py") "rst2latex.py" "rst2latex")
3241 (pseudoxml . ("rst2pseudoxml.py" ".xml" nil)) 3241 ".tex" nil)
3242 (xml . ("rst2xml.py" ".xml" nil))) 3242 (newlatex ,(if (executable-find "rst2newlatex.py") "rst2newlatex.py"
3243 "rst2newlatex")
3244 ".tex" nil)
3245 (pseudoxml ,(if (executable-find "rst2pseudoxml.py") "rst2pseudoxml.py"
3246 "rst2pseudoxml")
3247 ".xml" nil)
3248 (xml ,(if (executable-find "rst2xml.py") "rst2xml.py" "rst2xml")
3249 ".xml" nil)
3250 (pdf ,(if (executable-find "rst2pdf.py") "rst2pdf.py" "rst2pdf")
3251 ".pdf" nil)
3252 (s5 ,(if (executable-find "rst2s5.py") "rst2s5.py" "rst2s5")
3253 ".html" nil))
3243 "Table describing the command to use for each toolset. 3254 "Table describing the command to use for each toolset.
3244An association list of the toolset to a list of the (command to use, 3255An association list of the toolset to a list of the (command to use,
3245extension of produced filename, options to the tool (nil or a 3256extension of produced filename, options to the tool (nil or a
3246string)) to be used for converting the document.") 3257string)) to be used for converting the document."
3258 :type '(alist :options (html latex newlatex pseudoxml xml)
3259 :key-type symbol
3260 :value-type (list :tag "Specification"
3261 (file :tag "Command")
3262 (string :tag "File extension")
3263 (choice :tag "Command options"
3264 (const :tag "No options" nil)
3265 (string :tag "Options"))))
3266 :group 'rst
3267 :version "24.1")
3247 3268
3248;; Note for Python programmers not familiar with association lists: you can set 3269;; Note for Python programmers not familiar with association lists: you can set
3249;; values in an alists like this, e.g. : 3270;; values in an alists like this, e.g. :
@@ -3331,7 +3352,7 @@ or of the entire buffer, if the region is not selected."
3331 (shell-command-on-region 3352 (shell-command-on-region
3332 (if mark-active (region-beginning) (point-min)) 3353 (if mark-active (region-beginning) (point-min))
3333 (if mark-active (region-end) (point-max)) 3354 (if mark-active (region-end) (point-max))
3334 "rst2pseudoxml.py" 3355 (cadr (assq 'pseudoxml rst-compile-toolsets))
3335 standard-output))) 3356 standard-output)))
3336 3357
3337(defvar rst-pdf-program "xpdf" 3358(defvar rst-pdf-program "xpdf"
@@ -3341,6 +3362,8 @@ or of the entire buffer, if the region is not selected."
3341 "Convert the document to a PDF file and launch a preview program." 3362 "Convert the document to a PDF file and launch a preview program."
3342 (interactive) 3363 (interactive)
3343 (let* ((tmp-filename (make-temp-file "rst-out" nil ".pdf")) 3364 (let* ((tmp-filename (make-temp-file "rst-out" nil ".pdf"))
3365 (command (format "%s %s %s && %s %s"
3366 (cadr (assq 'pdf rst-compile-toolsets))
3344 (command (format "rst2pdf.py %s %s && %s %s" 3367 (command (format "rst2pdf.py %s %s && %s %s"
3345 buffer-file-name tmp-filename 3368 buffer-file-name tmp-filename
3346 rst-pdf-program tmp-filename))) 3369 rst-pdf-program tmp-filename)))
@@ -3356,7 +3379,10 @@ or of the entire buffer, if the region is not selected."
3356 "Convert the document to an S5 slide presentation and launch a preview program." 3379 "Convert the document to an S5 slide presentation and launch a preview program."
3357 (interactive) 3380 (interactive)
3358 (let* ((tmp-filename (make-temp-file "rst-slides" nil ".html")) 3381 (let* ((tmp-filename (make-temp-file "rst-slides" nil ".html"))
3382 (command (format "%s %s %s && %s %s"
3383 (cadr (assq 's5 rst-compile-toolsets))
3359 (command (format "rst2s5.py %s %s && %s %s" 3384 (command (format "rst2s5.py %s %s && %s %s"
3385
3360 buffer-file-name tmp-filename 3386 buffer-file-name tmp-filename
3361 rst-slides-program tmp-filename))) 3387 rst-slides-program tmp-filename)))
3362 (start-process-shell-command "rst-slides-preview" nil command) 3388 (start-process-shell-command "rst-slides-preview" nil command)
@@ -3454,11 +3480,10 @@ column is used (fill-column vs. end of previous/next line)."
3454 "A portable function that returns non-nil if the mark is active." 3480 "A portable function that returns non-nil if the mark is active."
3455 (cond 3481 (cond
3456 ((fboundp 'region-active-p) (region-active-p)) 3482 ((fboundp 'region-active-p) (region-active-p))
3457 ((boundp 'transient-mark-mode) transient-mark-mode mark-active))) 3483 ((boundp 'transient-mark-mode) (and transient-mark-mode mark-active))
3458 3484 (t mark-active)))
3459 3485
3460 3486
3461(provide 'rst) 3487(provide 'rst)
3462 3488
3463;; arch-tag: 255ac0a3-a689-44cb-8643-04ca55ae490d
3464;;; rst.el ends here 3489;;; rst.el ends here