Tweak auto-indent on yank advice
This commit is contained in:
parent
fc3ad64579
commit
5edc8a842f
|
@ -14,15 +14,12 @@
|
|||
([remap mark-sexp] . easy-mark))
|
||||
|
||||
(use-package emacs
|
||||
:config
|
||||
(defadvice exchange-point-and-mark (before deactivate-mark activate compile)
|
||||
"When called with no active region, do not activate mark."
|
||||
(interactive
|
||||
(list (not (region-active-p)))))
|
||||
|
||||
:hook
|
||||
(emacs-startup . (lambda ()
|
||||
;; Based on code in prelude-editor.el
|
||||
(defun yank-advised-indent-function (beg end)
|
||||
"Do indentation, as long as the region isn't too large."
|
||||
(if (<= (- end beg) 1000)
|
||||
(if (<= (- end beg) 10000)
|
||||
(indent-region beg end nil)))
|
||||
|
||||
(defmacro advise-commands (advice-name commands class &rest body)
|
||||
|
@ -41,7 +38,7 @@ The body of the advice is in BODY."
|
|||
(or (derived-mode-p 'prog-mode)
|
||||
(member major-mode '(LaTeX-mode TeX-mode))))
|
||||
(let ((transient-mark-mode nil))
|
||||
(yank-advised-indent-function (region-beginning) (region-end))))))
|
||||
(yank-advised-indent-function (region-beginning) (region-end))))))))
|
||||
|
||||
(provide 'init-kill)
|
||||
;;; init-kill.el ends here
|
||||
|
|
Loading…
Reference in New Issue