[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf 9c50487 165/310: Introduce list of major modes wher
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf 9c50487 165/310: Introduce list of major modes where VLF will not activate. |
Date: |
Sat, 28 Nov 2020 00:33:08 -0500 (EST) |
branch: externals/vlf
commit 9c50487982aaecff9a8824e7aa2c08420ca9c956
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Introduce list of major modes where VLF will not activate.
---
vlf.el | 43 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)
diff --git a/vlf.el b/vlf.el
index 9928d28..9bf8061 100644
--- a/vlf.el
+++ b/vlf.el
@@ -159,6 +159,45 @@ You can customize number of bytes displayed by customizing
(eval-after-load "dired"
'(define-key dired-mode-map "V" 'dired-vlf))
+;;;####autoload
+(defcustom vlf-forbidden-modes-list '(archive-mode tar-mode jka-compr
+ git-commit-mode)
+ "Major modes which VLF will not be automatically applied to."
+ :group 'vlf
+ :type '(list symbol))
+
+;;;####autoload
+(defun vlf-determine-major-mode (filename)
+ "Determine major mode from FILENAME."
+ (let ((name filename)
+ (remote-id (file-remote-p filename))
+ mode)
+ ;; Remove backup-suffixes from file name.
+ (setq name (file-name-sans-versions name))
+ ;; Remove remote file name identification.
+ (and (stringp remote-id)
+ (string-match (regexp-quote remote-id) name)
+ (setq name (substring name (match-end 0))))
+ (setq mode
+ (if (memq system-type '(windows-nt cygwin))
+ ;; System is case-insensitive.
+ (let ((case-fold-search t))
+ (assoc-default name auto-mode-alist
+ 'string-match))
+ ;; System is case-sensitive.
+ (or ;; First match case-sensitively.
+ (let ((case-fold-search nil))
+ (assoc-default name auto-mode-alist
+ 'string-match))
+ ;; Fallback to case-insensitive match.
+ (and auto-mode-case-fold
+ (let ((case-fold-search t))
+ (assoc-default name auto-mode-alist
+ 'string-match))))))
+ (if (and mode (consp mode))
+ (cadr mode)
+ mode)))
+
;;;###autoload
(defadvice abort-if-file-too-large (around vlf-if-file-too-large
(size op-type
@@ -168,7 +207,9 @@ You can customize number of bytes displayed by customizing
allow user to view file with `vlf', open it normally, or abort.
OP-TYPE specifies the file operation being performed over FILENAME."
(cond
- ((not vlf-application)
+ ((or (not vlf-application)
+ (memq (vlf-determine-major-mode filename)
+ vlf-forbidden-modes-list))
ad-do-it)
((eq vlf-application 'always)
(vlf filename)
- [elpa] externals/vlf 7a14109 137/310: Fix search for GNU Emacs 23 (no assert)., (continued)
- [elpa] externals/vlf 7a14109 137/310: Fix search for GNU Emacs 23 (no assert)., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 452b7eb 141/310: Ensure there are no modifications when executing searches., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a42247c 150/310: Automatically scroll to adjacent batch when start or end of chunk is, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 959bbc7 155/310: Disable undo in cases of partial chunk move., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a65f3a4 143/310: Check for unsaved changes before search query and don't enable undo if, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 42e581d 144/310: Add command to unconditionally open fresh VLF buffer to visit occur, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 3e8098a 149/310: Rename vlf-discard-edit -> vlf-refresh., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf c0a85cd 159/310: Fix position when moving to overlapping chunk., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 2aea17a 163/310: Fix behaviour when size is missing (creating file) in, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 88924f9 164/310: Fix vlf-write behaviour for newly created file., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 9c50487 165/310: Introduce list of major modes where VLF will not activate.,
Stefan Monnier <=
- [elpa] externals/vlf 152462a 166/310: Fix autoloads in last commit., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf e67895a 068/310: Optionally strip superfluous operations when inserting batches., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 6773248 104/310: Optimize a bit goto line., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 4134de0 177/310: Add intelligent recenter chunk around point functionality., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 9b22b74 134/310: Add gitignore., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 2dba838 140/310: In case original VLF buffer has been killed, try to find existing VLF, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf efae918 138/310: Turn vlf into minor mode., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf e36492b 182/310: Optimize chunk jumping for current GNU Emacs releases. Fix moving by, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf f1ade81 069/310: Add go to line command., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 3fb898e 070/310: Add automatic batching when scrolling., Stefan Monnier, 2020/11/28