evil icon indicating copy to clipboard operation
evil copied to clipboard

respect remapped write commands with evil-write-all

Open mohkale opened this issue 4 years ago • 0 comments

Issue type

  • Enhancement request

Environment

Emacs version: GNU Emacs 27.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.17, cairo version 1.17.3) of 2020-04-20 Operating System: Linux mk-desktop 5.6.12-arch1-1 #1 SMP PREEMPT Sun, 10 May 2020 10:43:42 +0000 x86_64 GNU/Linux Evil version: Evil version evil-git-9f6c01b Evil installation type: MELPA Graphical/Terminal: both Tested in a make emacs session (see CONTRIBUTING.md): No

Reproduction steps

Expected behavior

Actual behavior

Further notes

By default evil-write-all defers to save-some-buffers which just seems to write any buffers that have an associated file to their files. However in emacs there's often in memory buffers that have more complicated write functions. For example the buffer you reach after org-edit-special in a source code block doesn't have an associated file, but you can run org-edit-src-save and it has the same affect has saving this temporary edit-buffer. Now you can do:

(general-define-key
    :keymaps 'org-src-mode-map
    [remap evil-write] 'org-edit-src-save
    [remap evil-quit] 'org-edit-src-abort
    ;; save and then quit
    [remap evil-save-and-close] 'org-edit-src-exit
    [remap evil-save-modified-and-close] 'org-edit-src-exit)

and :w, :wq, :q behaves as you'd expect when in an org buffer. However there's no sensible parallel to evil-write-all. Therefore I've left it unmapped.

evil should have a function that's consistent with remapped evl-write commands and can be used from the ex command line :wa.

mohkale avatar Jun 10 '20 14:06 mohkale