summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Uberti <manuel@boccaperta.com>2015-04-24 08:49:28 +0200
committerDaiki Ueno <ueno@gnu.org>2015-04-24 17:36:38 +0900
commit83c8410bbdebd1fda6a8172dd8b1c06404a5582b (patch)
treedcb083028a11dba65591bee3adcdd7a4e1f7af59
parentbf97aa79451a316f221fe752b2b1eedeef4d4453 (diff)
downloadgettext-83c8410bbdebd1fda6a8172dd8b1c06404a5582b.tar.gz
po-mode: Add option to keep .mo when validating
* gettext-tools/misc/po-mode.el (po-keep-mo-file): New user option. (po-validate): Respect po-keep-mo-file. Fix comment indentation.
-rw-r--r--gettext-tools/misc/ChangeLog5
-rw-r--r--gettext-tools/misc/po-mode.el20
2 files changed, 20 insertions, 5 deletions
diff --git a/gettext-tools/misc/ChangeLog b/gettext-tools/misc/ChangeLog
index f288e9594..27dbce687 100644
--- a/gettext-tools/misc/ChangeLog
+++ b/gettext-tools/misc/ChangeLog
@@ -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
diff --git a/gettext-tools/misc/po-mode.el b/gettext-tools/misc/po-mode.el
index 1afba635f..8a1bc0ccb 100644
--- a/gettext-tools/misc/po-mode.el
+++ b/gettext-tools/misc/po-mode.el
@@ -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)))