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

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

[elpa] externals/leaf e99647d 09/13: update document, tagged v4.4.3


From: Stefan Monnier
Subject: [elpa] externals/leaf e99647d 09/13: update document, tagged v4.4.3
Date: Wed, 17 Mar 2021 18:45:36 -0400 (EDT)

branch: externals/leaf
commit e99647d925be7f49c0ff702e677dd7910b04aae1
Author: Naoya Yamashita <conao3@gmail.com>
Commit: Naoya Yamashita <conao3@gmail.com>

    update document, tagged v4.4.3
---
 README.md  | 44 ++++++++++++++++++++++++++++++++++++++++++++
 README.org | 41 +++++++++++++++++++++++++++++++++++++++++
 leaf.el    |  2 +-
 3 files changed, 86 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index f6ea083..d743fa9 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,7 @@
 - [Configure variables keywords](#configure-variables-keywords)
   - [:custom, :custom*, :custom-face 
keywords](#custom-custom-custom-face-keywords)
   - [:pre-setq, :setq, :setq-default 
keywords](#pre-setq-setq-setq-default-keywords)
+  - [:setf, :push, :pre-setf, :pre-push 
keywords](#sef-push-pre-setf-pre-push-keywords)
 - [Configure list keywords](#configure-list-keywords)
   - [:mode, :interpreter keywords](#mode-interpreter-keywords)
   - [:magic, :magic-fallback keywords](#magic-magic-fallback-keywords)
@@ -1169,6 +1170,49 @@ You can of course configure multiple variables and set 
the evaluation result of
 
 
 
+## :setf, :push, :pre-setf, :pre-push keywords
+
+These keywords provide a front end to ~setf~ and ~push~.
+
+Note that, *unlike :setq*, it always requires a list of cons cell.
+
+
+```emacs-lisp
+(cort-deftest-with-macroexpand leaf/setf
+  '(
+    ;; :setf require cons-cell list ONLY.
+    ((leaf alloc
+       :setf ((gc-cons-threshold . 536870912)
+              (garbage-collection-messages . t))
+       :require t)
+     (prog1 'alloc
+       (require 'alloc)
+       (setf gc-cons-threshold 536870912)
+       (setf garbage-collection-messages t)))
+
+    ;; left value could generalized variable (alist-get, plist-get...)
+    ;; note that it is specified as the car of the cons list.
+    ((leaf emacs
+       :setf
+       (((alist-get "gnu" package-archives) . "http://elpa.gnu.org/packages/";)
+        ((alist-get 'vertical-scroll-bars default-frame-alist) . nil)))
+     (prog1 'emacs
+       (setf (alist-get "gnu" package-archives) 
"http://elpa.gnu.org/packages/";)
+       (setf (alist-get 'vertical-scroll-bars default-frame-alist) nil)))))
+
+(cort-deftest-with-macroexpand leaf/push
+  '(
+    ;; :setf require cons-cell list ONLY.
+    ((leaf emacs
+       :push ((package-archives . '("melpa" . "https://melpa.org/packages/";))
+              (auto-mode-alist . '("\\.jpe?g\\'" . image-mode))))
+     (prog1 'emacs
+       (push '("melpa" . "https://melpa.org/packages/";) package-archives)
+       (push '("\\.jpe?g\\'" . image-mode) auto-mode-alist)))))
+```
+
+
+
 # Configure list keywords
 
 
diff --git a/README.org b/README.org
index 1e265bb..251288f 100644
--- a/README.org
+++ b/README.org
@@ -36,6 +36,7 @@
 - [[Configure variables keywords]]
   - [[:custom, :custom*, :custom-face keywords]]
   - [[:pre-setq, :setq, :setq-default keywords]]
+  - [[:setf, :push, :pre-setf, :pre-push keywords]]
 - [[Configure list keywords]]
   - [[:mode, :interpreter keywords]]
   - [[:magic, :magic-fallback keywords]]
@@ -1280,6 +1281,46 @@ result of some S expression to variable.
          (setq-default garbage-collection-messages t)))))
 #+end_src
 
+** :setf, :push, :pre-setf, :pre-push keywords
+
+These keywords provide a front end to ~setf~ and ~push~.
+
+Note that, *unlike :setq*, it always requires a list of cons cell.
+
+#+begin_src emacs-lisp
+  (cort-deftest-with-macroexpand leaf/setf
+    '(
+      ;; :setf require cons-cell list ONLY.
+      ((leaf alloc
+         :setf ((gc-cons-threshold . 536870912)
+                (garbage-collection-messages . t))
+         :require t)
+       (prog1 'alloc
+         (require 'alloc)
+         (setf gc-cons-threshold 536870912)
+         (setf garbage-collection-messages t)))
+
+      ;; left value could generalized variable (alist-get, plist-get...)
+      ;; note that it is specified as the car of the cons list.
+      ((leaf emacs
+         :setf
+         (((alist-get "gnu" package-archives) . 
"http://elpa.gnu.org/packages/";)
+          ((alist-get 'vertical-scroll-bars default-frame-alist) . nil)))
+       (prog1 'emacs
+         (setf (alist-get "gnu" package-archives) 
"http://elpa.gnu.org/packages/";)
+         (setf (alist-get 'vertical-scroll-bars default-frame-alist) nil)))))
+
+  (cort-deftest-with-macroexpand leaf/push
+    '(
+      ;; :setf require cons-cell list ONLY.
+      ((leaf emacs
+         :push ((package-archives . '("melpa" . "https://melpa.org/packages/";))
+                (auto-mode-alist . '("\\.jpe?g\\'" . image-mode))))
+       (prog1 'emacs
+         (push '("melpa" . "https://melpa.org/packages/";) package-archives)
+         (push '("\\.jpe?g\\'" . image-mode) auto-mode-alist)))))
+#+end_src
+
 * Configure list keywords
 
 ** :mode, :interpreter keywords
diff --git a/leaf.el b/leaf.el
index 807ffca..d0e0c23 100644
--- a/leaf.el
+++ b/leaf.el
@@ -5,7 +5,7 @@
 ;; Author: Naoya Yamashita <conao3@gmail.com>
 ;; Maintainer: Naoya Yamashita <conao3@gmail.com>
 ;; Keywords: lisp settings
-;; Version: 4.4.2
+;; Version: 4.4.3
 ;; URL: https://github.com/conao3/leaf.el
 ;; Package-Requires: ((emacs "24.1"))
 



reply via email to

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