core-editor: minor refactor; associate LICENSE w/ text-mode
This commit is contained in:
parent
a24a3ef292
commit
611d8fe6bc
1 changed files with 13 additions and 13 deletions
|
@ -61,17 +61,6 @@ modes are active and the buffer is read-only.")
|
||||||
(ignore (bury-buffer))))
|
(ignore (bury-buffer))))
|
||||||
(add-hook 'kill-buffer-query-functions #'doom|dont-kill-scratch-buffer)
|
(add-hook 'kill-buffer-query-functions #'doom|dont-kill-scratch-buffer)
|
||||||
|
|
||||||
(defun doom*delete-trailing-whitespace (orig-fn &rest args)
|
|
||||||
"Don't affect trailing whitespace on current line."
|
|
||||||
(let ((linestr (buffer-substring-no-properties
|
|
||||||
(line-beginning-position)
|
|
||||||
(line-end-position))))
|
|
||||||
(apply orig-fn args)
|
|
||||||
(when (and (if (featurep 'evil) (evil-insert-state-p) t)
|
|
||||||
(string-match-p "^[\s\t]*$" linestr))
|
|
||||||
(insert linestr))))
|
|
||||||
(advice-add #'delete-trailing-whitespace :around #'doom*delete-trailing-whitespace)
|
|
||||||
|
|
||||||
(defun doom|check-large-file ()
|
(defun doom|check-large-file ()
|
||||||
"Check if the buffer's file is large (see `doom-large-file-size'). If so, ask
|
"Check if the buffer's file is large (see `doom-large-file-size'). If so, ask
|
||||||
for confirmation to open it literally (read-only, disabled undo and in
|
for confirmation to open it literally (read-only, disabled undo and in
|
||||||
|
@ -111,10 +100,8 @@ enable multiple minor modes for the same regexp.")
|
||||||
(if (string-match-p (caar alist) name)
|
(if (string-match-p (caar alist) name)
|
||||||
(funcall (cdar alist) 1))
|
(funcall (cdar alist) 1))
|
||||||
(setq alist (cdr alist))))))
|
(setq alist (cdr alist))))))
|
||||||
|
|
||||||
(add-hook 'find-file-hook #'doom|enable-minor-mode-maybe)
|
(add-hook 'find-file-hook #'doom|enable-minor-mode-maybe)
|
||||||
|
|
||||||
;; ensure indirect buffers have buffer-file-name
|
|
||||||
(defun doom*set-indirect-buffer-filename (orig-fn base-buffer name &optional clone)
|
(defun doom*set-indirect-buffer-filename (orig-fn base-buffer name &optional clone)
|
||||||
"In indirect buffers, `buffer-file-name' is nil, which can cause problems
|
"In indirect buffers, `buffer-file-name' is nil, which can cause problems
|
||||||
with functions that require it (like modeline segments)."
|
with functions that require it (like modeline segments)."
|
||||||
|
@ -128,6 +115,19 @@ with functions that require it (like modeline segments)."
|
||||||
buffer))
|
buffer))
|
||||||
(advice-add #'make-indirect-buffer :around #'doom*set-indirect-buffer-filename)
|
(advice-add #'make-indirect-buffer :around #'doom*set-indirect-buffer-filename)
|
||||||
|
|
||||||
|
(defun doom*delete-trailing-whitespace (orig-fn &rest args)
|
||||||
|
"Don't affect trailing whitespace on current line."
|
||||||
|
(let ((linestr (buffer-substring-no-properties
|
||||||
|
(line-beginning-position)
|
||||||
|
(line-end-position))))
|
||||||
|
(apply orig-fn args)
|
||||||
|
(when (and (if (featurep 'evil) (evil-insert-state-p) t)
|
||||||
|
(string-match-p "^[\s\t]*$" linestr))
|
||||||
|
(insert linestr))))
|
||||||
|
(advice-add #'delete-trailing-whitespace :around #'doom*delete-trailing-whitespace)
|
||||||
|
|
||||||
|
(push '("/LICENSE$" . text-mode) auto-mode-alist)
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Built-in plugins
|
;; Built-in plugins
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue