On 24/04/15 00:37, Daiki Ueno wrote:
> Manuel Uberti <[email protected]> writes:
> 
>> I would like to know if it is possible to add a feature. Basically, a
>> setting that can be enabled to keep MO files from validation instead of
>> discarding them.
>>
>> I already edit the source code and tested it on my machine, I did a pull
>> request on emacsmirror/po-mode but I don't know if this is the right
>> thing to do.
>>
>> Is there another way to submit my pull request?
> 
> Enhancements are more than welcome.  You can simply format the patches
> against the gettext git repo:
> http://git.savannah.gnu.org/cgit/gettext.git/tree/gettext-tools/misc
> and send them to this mailing list.
> 
> Is this the corresponding pull-request?
> https://github.com/emacsmirror/po-mode/pull/1
> Looks good anyway.
> 
> Thanks,
> 

Hi,

I format the patch against the gettext git repo, you can find it
attached to this email.

Hope everything is good, it's the first time I work on a fix like this
so I might have done something wrong.

Manuel Uberti - http://informatica.boccaperta.com
<[email protected]>
>From 22d9bb459c150f4c271614f6667f76701526a976 Mon Sep 17 00:00:00 2001
From: boccaperta-it <[email protected]>
Date: Fri, 24 Apr 2015 08:49:28 +0200
Subject: [PATCH 1/2] po-keep-mo-file: keep/discard mo files setting

---
 gettext-tools/misc/po-mode.el | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/gettext-tools/misc/po-mode.el b/gettext-tools/misc/po-mode.el
index 1afba63..d7e9987 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,10 +3350,10 @@ 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
@@ -3357,9 +3362,14 @@ Leave point after marked string."
          (compilation-buffer-name-function
           (function (lambda (mode-name)
                       (concat "*" mode-name " validation*"))))
-         (compile-command (concat po-msgfmt-program
-                                  " --statistics -c -v -o " dev-null " "
-                                  (shell-quote-argument buffer-file-name))))
+         (compile-command (if po-keep-mo-file
+                              (concat po-msgfmt-program
+                                      " --statistics -c -v -o "
+                                      (substring buffer-file-name 0 -2) "mo "
+                                      (shell-quote-argument buffer-file-name))
+                            (concat po-msgfmt-program
+                                    " --statistics -c -v -o " dev-null " "
+                                    (shell-quote-argument buffer-file-name)))))
     (po-msgfmt-version-check)
     (compile compile-command)))
 
-- 
2.1.4


>From 517d8affc778e0fa90ff37f1e2abf54596fe9307 Mon Sep 17 00:00:00 2001
From: boccaperta-it <[email protected]>
Date: Fri, 24 Apr 2015 08:51:31 +0200
Subject: [PATCH 2/2] Fix comments indentation

---
 gettext-tools/misc/po-mode.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gettext-tools/misc/po-mode.el b/gettext-tools/misc/po-mode.el
index d7e9987..b5ee360 100644
--- a/gettext-tools/misc/po-mode.el
+++ b/gettext-tools/misc/po-mode.el
@@ -3350,10 +3350,10 @@ 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
-- 
2.1.4

Reply via email to