Fix autoformat in org mode opening dialogue
Now every saving by default formats the buffer, only using :w skips that
This commit is contained in:
parent
f47ecce302
commit
4cc2834027
@ -43,10 +43,13 @@
|
|||||||
(map! :desc "Flycheck previous error" :nv "g N" #'flycheck-previous-error)
|
(map! :desc "Flycheck previous error" :nv "g N" #'flycheck-previous-error)
|
||||||
(map! :leader "c X" #'flycheck-list-errors)
|
(map! :leader "c X" #'flycheck-list-errors)
|
||||||
|
|
||||||
(map! :desc "Format and save" :g "C-s" #'fd-format-and-save)
|
(map! :desc "Save" :g "C-s" #'save-buffer)
|
||||||
(map! :leader "w 1" #'delete-other-windows)
|
(map! :leader "w 1" #'delete-other-windows)
|
||||||
(map! :leader "t p" #'+popup/toggle)
|
(map! :leader "t p" #'+popup/toggle)
|
||||||
|
|
||||||
|
;; Do not use autosave when using vim save command
|
||||||
|
(evil-ex-define-cmd "write" #'fd-format-without-autosave)
|
||||||
|
|
||||||
(dotimes (counter 9)
|
(dotimes (counter 9)
|
||||||
(let ((command (format "(map! :leader \"%d\" #'winum-select-window-%d)"
|
(let ((command (format "(map! :leader \"%d\" #'winum-select-window-%d)"
|
||||||
(1+ counter) (1+ counter))))
|
(1+ counter) (1+ counter))))
|
||||||
@ -56,24 +59,11 @@
|
|||||||
|
|
||||||
(setq-default evil-escape-key-sequence "kj")
|
(setq-default evil-escape-key-sequence "kj")
|
||||||
|
|
||||||
(defun fd-format-and-save()
|
(defun fd-format-without-autosave()
|
||||||
(interactive)
|
(interactive)
|
||||||
(company-abort)
|
(let ((current-prefix-arg 4)) ;; pass universal argument
|
||||||
(evil-force-normal-state)
|
(call-interactively #'save-buffer))
|
||||||
;; (without-minibuffer '+format/buffer) ; Skip if no formatter is defined (e.g. in text mode)
|
)
|
||||||
(+format/buffer) ; Skip if no formatter is defined (e.g. in text mode)
|
|
||||||
(save-buffer))
|
|
||||||
|
|
||||||
(defmacro without-minibuffer (&rest body)
|
|
||||||
"Like `progn', but stop and return nil if any of BODY forms tries to use the minibuffer.
|
|
||||||
|
|
||||||
Also disable dialogs while evaluating BODY forms, since dialogs
|
|
||||||
are just an alternative to the minibuffer."
|
|
||||||
`(catch 'tried-to-use-minibuffer
|
|
||||||
(minibuffer-with-setup-hook
|
|
||||||
(lambda (&rest args) (throw 'tried-to-use-minibuffer nil))
|
|
||||||
(let ((use-dialog-box)) ; No cheating by using dialogs instead of minibuffer
|
|
||||||
,@body))))
|
|
||||||
|
|
||||||
;; Do not ask before exiting emacs
|
;; Do not ask before exiting emacs
|
||||||
(setq confirm-kill-emacs nil)
|
(setq confirm-kill-emacs nil)
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
(evil +everywhere); come to the dark side, we have cookies
|
(evil +everywhere); come to the dark side, we have cookies
|
||||||
file-templates ; auto-snippets for empty files
|
file-templates ; auto-snippets for empty files
|
||||||
fold ; (nigh) universal code folding
|
fold ; (nigh) universal code folding
|
||||||
format ;+onsave) ; automated prettiness
|
(format +onsave) ; automated prettiness
|
||||||
;;god ; run Emacs commands without modifier keys
|
;;god ; run Emacs commands without modifier keys
|
||||||
;; lispy ; vim for lisp, for people who don't like vim
|
;; lispy ; vim for lisp, for people who don't like vim
|
||||||
;;multiple-cursors ; editing in many places at once
|
;;multiple-cursors ; editing in many places at once
|
||||||
@ -151,7 +151,7 @@
|
|||||||
;;lua ; one-based indices? one-based indices
|
;;lua ; one-based indices? one-based indices
|
||||||
markdown ; writing docs for people to ignore
|
markdown ; writing docs for people to ignore
|
||||||
;;nim ; python + lisp at the speed of c
|
;;nim ; python + lisp at the speed of c
|
||||||
nix ; I hereby declare "nix geht mehr!"
|
(nix +lsp) ; I hereby declare "nix geht mehr!"
|
||||||
;;ocaml ; an objective camel
|
;;ocaml ; an objective camel
|
||||||
(org +dragndrop +pandoc +pretty +roam2 +pomodoro +noter) ; organize your plain life in plain text
|
(org +dragndrop +pandoc +pretty +roam2 +pomodoro +noter) ; organize your plain life in plain text
|
||||||
;;php ; perl's insecure younger brother
|
;;php ; perl's insecure younger brother
|
||||||
|
Loading…
x
Reference in New Issue
Block a user