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

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

[nongnu] elpa/helm d0312c59b4: Improve set/edit variable fns


From: ELPA Syncer
Subject: [nongnu] elpa/helm d0312c59b4: Improve set/edit variable fns
Date: Tue, 6 Jun 2023 01:00:28 -0400 (EDT)

branch: elpa/helm
commit d0312c59b4d4aae036ac5c6d5392121a0c73d5dd
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>

    Improve set/edit variable fns
    
    Use set-default when editing vars
    Don't quote vectors when setting vars
    Don't quote lists when already quoted by user
    Improve skipping headers in edit var buffer
---
 helm-elisp.el |  2 +-
 helm-lib.el   | 15 ++++++++++-----
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/helm-elisp.el b/helm-elisp.el
index a55fa46024..31be880a18 100644
--- a/helm-elisp.el
+++ b/helm-elisp.el
@@ -936,7 +936,7 @@ a string, i.e. the `symbol-name' of any existing symbol."
         (helm-edit-variable var)
       (set-default sym (eval-minibuffer
                         (format "Set `%s': " var)
-                        (if (or (stringp val)
+                        (if (or (arrayp val)
                                 (memq val '(nil t))
                                 (numberp val))
                             strv
diff --git a/helm-lib.el b/helm-lib.el
index 2f96dd65e5..1fa72cd04e 100644
--- a/helm-lib.el
+++ b/helm-lib.el
@@ -1330,6 +1330,7 @@ Special commands:
     (with-current-buffer (get-buffer-create helm-pretty-print-buffer-name)
       (erase-buffer)
       (helm-edit-variable-mode)
+      ;; Any number of lines starting with ";;;" + one empty line.
       (insert (format ";;; Edit variable `%s' and hit C-c C-c when done\n" sym)
               ";;; Abort with C-c C-k\n\n")
       (set (make-local-variable 'helm-pretty-print-current-symbol) sym)
@@ -1340,14 +1341,18 @@ Special commands:
   (interactive)
   (with-current-buffer helm-pretty-print-buffer-name
     (goto-char (point-min))
-    (forward-line 3)
+    (when (re-search-forward "^$" nil t)
+      (forward-line 1))
     (let ((val (symbol-value helm-pretty-print-current-symbol)))
       (save-excursion
-        (if (or (stringp val)
+        (if (or (arrayp val)
                 (memq val '(nil t))
-                (numberp val))
-            (set helm-pretty-print-current-symbol (read (current-buffer)))
-          (set helm-pretty-print-current-symbol `(,@(read (current-buffer))))))
+                (numberp val)
+                (looking-at "[`']"))
+            (set-default helm-pretty-print-current-symbol
+                         (read (current-buffer)))
+          (set-default helm-pretty-print-current-symbol
+                       `(,@(read (current-buffer))))))
       (if (equal val (symbol-value helm-pretty-print-current-symbol))
           (message "No changes done")
         (message "`%s' value modified" helm-pretty-print-current-symbol))



reply via email to

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