emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/jinx 125c3c9f9d 1/2: jinx-languages: Ask if the file-lo


From: ELPA Syncer
Subject: [elpa] externals/jinx 125c3c9f9d 1/2: jinx-languages: Ask if the file-local variable should be saved
Date: Thu, 6 Apr 2023 12:59:16 -0400 (EDT)

branch: externals/jinx
commit 125c3c9f9dcbc62e21b1d2cef273a18f7abfc33b
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    jinx-languages: Ask if the file-local variable should be saved
---
 CHANGELOG.org |  6 ++++--
 jinx.el       | 10 +++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index db43845f35..f5458db624 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -7,8 +7,10 @@
 - Fix the type of a few characters: =.= punctuation character, ='= word 
character, =%=
   and =$= identifier characters.
 - Abandon =flyspell-mode-predicate= completely. Rely on faces only.
-- =jinx-languages=: This variable must be a string now. Multiple language codes
-  can be separated by space.
+- =jinx-languages=: The value must be a string now. Multiple language codes 
can be
+  separated by space.
+- =jinx-languages=: Ask if the file-local variable should be saved when 
changing
+  the language.
 - Add =jinx-local-words= to save file-local words. =jinx-correct= supports 
saving to
   =jinx-local-words= by pressing =*=.
 
diff --git a/jinx.el b/jinx.el
index 8d502c03bb..041d6650c5 100644
--- a/jinx.el
+++ b/jinx.el
@@ -160,7 +160,7 @@ checking."
        "\\w*?[0-9]\\w*\\>" ;; Words with numbers, hex codes
        "[a-z]+://\\S-+"    ;; URI
        "<?[-+_.~a-zA-Z][-+_.~:a-zA-Z0-9]*@[-.a-zA-Z0-9]+>?" ;; Email
-       "End:\\s-*$"             ;; Local variable end indicator
+       "\\(?:Local Variables\\|End\\):\\s-*$" ;; Local variable indicator
        "jinx-\\(?:languages\\|local-words\\):\\s-+.*$")) ;; Local variables
   "List of excluded regexps per major mode."
   :type '(alist :key-type symbol :value-type (repeat regexp)))
@@ -634,10 +634,14 @@ With prefix argument GLOBAL non-nil change the languages 
globally."
                        (string-join (split-string jinx-languages) ", "))
                (delete-dups (jinx--mod-langs)) nil t)))
     (setq langs (string-join langs " "))
-    (if (not global)
-        (setq-local jinx-languages langs)
+    (cond
+     (global
       (kill-local-variable 'jinx-languages)
       (setq-default jinx-languages langs))
+     (t
+      (setq-local jinx-languages langs)
+      (when (y-or-n-p "Save `jinx-languages' as file-local variable? ")
+        (add-file-local-variable 'jinx-languages jinx-languages))))
     (jinx--load-dicts)
     (jinx--cleanup)))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]