]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
po-mode: Add option to keep .mo when validating
authorManuel Uberti <manuel@boccaperta.com>
Fri, 24 Apr 2015 06:49:28 +0000 (08:49 +0200)
committerDaiki Ueno <ueno@gnu.org>
Fri, 24 Apr 2015 08:36:38 +0000 (17:36 +0900)
* gettext-tools/misc/po-mode.el (po-keep-mo-file): New user option.
(po-validate): Respect po-keep-mo-file.  Fix comment indentation.

gettext-tools/misc/ChangeLog
gettext-tools/misc/po-mode.el

index f288e9594b705f3cefb81f90043fcfd6b11ae44a..27dbce6871444c9b792bf62534028fe4b5a3918b 100644 (file)
@@ -1,3 +1,8 @@
+2015-04-24  Manuel Uberti  <manuel@boccaperta.com>  (tiny change)
+
+       * po-mode.el (po-keep-mo-file): New user option.
+       (po-validate): Respect po-keep-mo-file.  Fix comment indentation.
+
 2015-01-21  Peter Eisentraut  <peter@eisentraut.org>  (tiny change)
 
        * po-mode.el (po-font-lock-keywords): Support all possible length
index 1afba635f1f8bd0ce101fae8a7925b95be83c69a..8a1bc0ccbb899661b3442fa60cfb1b216c9868a8 100644 (file)
@@ -130,6 +130,11 @@ Value is nil, t, or ask."
   :type 'boolean
   :group 'po)
 
+(defcustom po-keep-mo-file nil
+  "*Set whether MO file should be kept or discarded after validation."
+  :type 'boolean
+  :group 'po)
+
 (defcustom po-auto-update-file-header t
   "*Automatically revise headers.  Value is nil, t, or ask."
   :type '(choice (const nil)
@@ -3345,20 +3350,25 @@ Leave point after marked string."
 (defun po-validate ()
   "Use 'msgfmt' for validating the current PO file contents."
   (interactive)
-  ; The 'compile' subsystem is autoloaded through a call to (compile ...).
-  ; We need to initialize it outside of any binding. Without this statement,
-  ; all defcustoms and defvars of compile.el would be undone when the let*
-  ; terminates.
+  ;; The 'compile' subsystem is autoloaded through a call to (compile ...).
+  ;; We need to initialize it outside of any binding. Without this statement,
+  ;; all defcustoms and defvars of compile.el would be undone when the let*
+  ;; terminates.
   (require 'compile)
   (let* ((dev-null
           (cond ((boundp 'null-device) null-device) ; since Emacs 20.3
                 ((memq system-type '(windows-nt windows-95)) "NUL")
                 (t "/dev/null")))
+         (output
+          (if po-keep-mo-file
+              (concat (file-name-sans-extension buffer-file-name) ".mo")
+            dev-null))
          (compilation-buffer-name-function
           (function (lambda (mode-name)
                       (concat "*" mode-name " validation*"))))
          (compile-command (concat po-msgfmt-program
-                                  " --statistics -c -v -o " dev-null " "
+                                  " --statistics -c -v -o "
+                                  (shell-quote-argument output) " "
                                   (shell-quote-argument buffer-file-name))))
     (po-msgfmt-version-check)
     (compile compile-command)))