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

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

[nongnu] elpa/cycle-at-point 0c07fc7f1f 16/18: Add cycle-at-point-preset


From: ELPA Syncer
Subject: [nongnu] elpa/cycle-at-point 0c07fc7f1f 16/18: Add cycle-at-point-preset-override, useful for tree-sitter modes
Date: Sun, 21 Apr 2024 21:59:38 -0400 (EDT)

branch: elpa/cycle-at-point
commit 0c07fc7f1f4c2369fe59423f3227e32a7039b3b5
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>

    Add cycle-at-point-preset-override, useful for tree-sitter modes
---
 cycle-at-point.el | 12 +++++++++++-
 readme.rst        |  4 ++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/cycle-at-point.el b/cycle-at-point.el
index 566d632df3..56e81d0db4 100644
--- a/cycle-at-point.el
+++ b/cycle-at-point.el
@@ -54,6 +54,11 @@
 ;; ---------------------------------------------------------------------------
 ;; Custom Variables
 
+(defcustom cycle-at-point-preset-override nil
+  "The symbol to use for the preset, when nil the `major-mode' is used.
+You may wish to override this value to us a preset from a different major 
mode."
+  :type '(choice (const nil) string))
+
 (defvar-local cycle-at-point-list nil
   "Buffer local list of literals to cycle.
 
@@ -303,7 +308,12 @@ The first is PRESET-ID to override the current 
`major-mode'.
 The second is QUIET, when non-nil, don't show a message
 when the preset isn't found."
   (unless preset-id
-    (setq preset-id (symbol-name major-mode)))
+    (setq preset-id
+          (cond
+           (cycle-at-point-preset-override
+            cycle-at-point-preset-override)
+           (t
+            (symbol-name major-mode)))))
   (let ((preset-sym (intern (concat "cycle-at-point-preset-" preset-id))))
     (when (condition-case err
               (progn
diff --git a/readme.rst b/readme.rst
index 74d5fb76e1..957fc2d825 100644
--- a/readme.rst
+++ b/readme.rst
@@ -112,6 +112,10 @@ Key binding example, using ``Alt-Shift-P``:
 Customization
 -------------
 
+``cycle-at-point-preset-override``
+   The identifier to use when loading a preset, this can be useful if you wish 
the use the preset
+   from a different major-mode (especially in the case of tree-sitter major 
modes).
+
 ``cycle-at-point-list``
    Setting this value is optional, when left unset a preset will be used when 
available.
 



reply via email to

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