branch: externals/vlf
commit 95e625938e71c0cc5632a1e14e6147f245decc97
Author: Andrey Kotlarski <[email protected]>
Commit: Andrey Kotlarski <[email protected]>
Add convenience macro to disable VLF application during execution of
specific function.
---
README.org | 14 ++++++++++++++
vlf-integrate.el | 31 +++++++++++++++++--------------
2 files changed, 31 insertions(+), 14 deletions(-)
diff --git a/README.org b/README.org
index d88ca3f..538d44f 100644
--- a/README.org
+++ b/README.org
@@ -59,6 +59,20 @@ that vlf-mode automatically launches for large files:
'(vlf-application 'dont-ask))
#+END_EXAMPLE
+*** Disable for specific mode
+
+To disable automatic usage of VLF for a major mode, add it to
+*vlf-forbidden-modes-list*.
+
+*** Disable for specific function
+
+To disable automatic usage of VLF for a function, for example named
+*func* defined in file *file.el*:
+
+#+BEGIN_EXAMPLE
+(vlf-disable-for-function func "file.el")
+#+END_EXAMPLE
+
** Keymap
All VLF operations are grouped under the *C-c C-v* prefix by default.
diff --git a/vlf-integrate.el b/vlf-integrate.el
index 6ba8aa1..cf21898 100644
--- a/vlf-integrate.el
+++ b/vlf-integrate.el
@@ -124,20 +124,23 @@ OP-TYPE specifies the file operation being performed over
FILENAME."
((memq char '(?a ?A))
(error "Aborted"))))))))
-(eval-after-load "etags"
- '(progn
- (defadvice tags-verify-table (around vlf-tags-verify-table
- compile activate)
- "Temporarily disable `vlf-mode'."
- (let ((vlf-application nil))
- ad-do-it))
-
- (defadvice tag-find-file-of-tag-noselect
- (around vlf-tag-find-file-of-tag compile activate)
- "Temporarily disable `vlf-mode'."
- (let ((vlf-application nil))
- ad-do-it))))
-
+;; disable for some functions
+(defmacro vlf-disable-for-function (func file)
+ "Build advice to disable VLF during execution of FUNC\
+defined in FILE."
+ `(eval-after-load ,file
+ '(defadvice ,func (around ,(intern (concat "vlf-"
+ (symbol-name func)))
+ compile activate)
+ "Temporarily disable `vlf-mode'."
+ (let ((vlf-application nil))
+ ad-do-it))))
+
+(vlf-disable-for-function tags-verify-table "etags")
+(vlf-disable-for-function tag-find-file-of-tag-noselect "etags")
+(vlf-disable-for-function helm-etags-create-buffer "helm-tags")
+
+;; dired
(defun dired-vlf ()
"In Dired, visit the file on this line in VLF mode."
(interactive)