[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/objed cf1db37 140/216: Allow users to define a function
From: |
Stefan Monnier |
Subject: |
[elpa] externals/objed cf1db37 140/216: Allow users to define a function to allow/prevent objed init |
Date: |
Tue, 8 Jan 2019 12:29:27 -0500 (EST) |
branch: externals/objed
commit cf1db37de54d52a648c443e5671bb8fb31a89cbc
Author: Clemera <address@hidden>
Commit: Clemera <address@hidden>
Allow users to define a function to allow/prevent objed init
---
objed.el | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/objed.el b/objed.el
index 0e58552..0aa8be5 100644
--- a/objed.el
+++ b/objed.el
@@ -91,7 +91,7 @@
;; `objed-define-object'.
;;
;; Although some features are still experimental the basic user interface will
-;; stay the same.
+;; stay the same.
;;
;;
;; CONTRIBUTE:
@@ -155,9 +155,8 @@
;; * User Settings and Variables
-(defcustom objed-disabled-modes
- '(special-mode dired-mode)
- "List of modes for which objed should stay disabled.
+(defcustom objed-disabled-modes '()
+ "List of modes for which objed should stay disabled.
If the current `major-mode' is in the list or derives from a
member of it `objed' will not activate.
@@ -166,6 +165,11 @@ See also `objed-disabled-p'"
:group 'objed
:type '(repeat symbol))
+(defcustom objed-init-p-function #'objed-init-p
+ "Function which test if objed is allowd to initialize.
+
+The function should return nil if objed should not initialize.")
+
(defcustom objed-cmd-alist
'(
@@ -307,7 +311,6 @@ removed."
:type 'symbol)
-
;; optional dep options
(defcustom objed-use-which-key-if-available-p t
@@ -1012,11 +1015,8 @@ See `objed-cmd-alist'."
(not objed-disabled-p)
(not (eq (cadr overriding-terminal-local-map)
objed-map))
- ;; (memq (key-binding "q")
- ;; '(self-insert-command
- ;; outshine-self-insert-command
- ;; org-self-insert-command))
- (or (memq major-mode '(messages-buffer-mode help-mode))
+ (funcall objed-init-p-function)
+ (or (not objed-disabled-modes)
(not (apply 'derived-mode-p objed-disabled-modes))))
(objed--init cmd)))
@@ -1045,7 +1045,15 @@ See `objed-cmd-alist'."
;; use the mark instead
(if (eq this-command #'end-of-buffer)
(objed--change-to :beg (mark) :ibeg (mark))
- (objed--change-to :beg pos :ibeg pos)))
+ (objed--change-to :beg pos :ibeg pos)))
+
+(defun objed-init-p ()
+ "Default for `objed-init-p-function'."
+ (memq (key-binding "n")
+ '(self-insert-command
+ outshine-self-insert-command
+ org-self-insert-command
+ undefined)))
(defun objed--init (&optional sym)
"Initialize `objed'.
- [elpa] externals/objed c87e826 150/216: Add News file to document changes., (continued)
- [elpa] externals/objed c87e826 150/216: Add News file to document changes., Stefan Monnier, 2019/01/08
- [elpa] externals/objed db542e0 127/216: Add replace inside object op, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 8d3399a 132/216: Adjust mark bindings, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 78116f5 151/216: Mention Readme and News, Stefan Monnier, 2019/01/08
- [elpa] externals/objed d801608 148/216: Cleanup for extend, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 6ed0f62 146/216: Merge remote-tracking branch 'origin/master', Stefan Monnier, 2019/01/08
- [elpa] externals/objed 862d168 164/216: Fix ipipe schedule timer, Stefan Monnier, 2019/01/08
- [elpa] externals/objed a0a8f81 158/216: Improve exchange point and mark, Stefan Monnier, 2019/01/08
- [elpa] externals/objed e9bfd92 156/216: Switch code order to avoid confusing compile warnings, Stefan Monnier, 2019/01/08
- [elpa] externals/objed add4b8f 154/216: Markup again, Stefan Monnier, 2019/01/08
- [elpa] externals/objed cf1db37 140/216: Allow users to define a function to allow/prevent objed init,
Stefan Monnier <=
- [elpa] externals/objed 26c88ba 168/216: Revert to 0, 1 is needed for 10>, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 39095c2 143/216: Add type specifications to defcustom calls, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 5c20c43 176/216: Improve org element/block object, don't inherit from paragraph, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 30eb150 166/216: Improve exit minibuffer for ipipe, Stefan Monnier, 2019/01/08
- [elpa] externals/objed fa3b6db 161/216: Add include leading/trailing whitespace commands, Stefan Monnier, 2019/01/08
- [elpa] externals/objed de2d6e1 162/216: Toggle for repeating objed-extend, Stefan Monnier, 2019/01/08
- [elpa] externals/objed ec04ce3 182/216: Simplify exit-op logic, Stefan Monnier, 2019/01/08
- [elpa] externals/objed d0bc8c7 165/216: Update docs for ipipe, Stefan Monnier, 2019/01/08
- [elpa] externals/objed ee50345 170/216: Rephrase, Stefan Monnier, 2019/01/08
- [elpa] externals/objed 76779dc 197/216: Adjust activation condition again, Stefan Monnier, 2019/01/08