Somelauw / evil-org-mode

Supplemental evil-mode keybindings to emacs org-mode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

:wq doesn't do the right thing from org src buffers

dieggsy opened this issue · comments

commented

From an org src buffer, :w does save the original file, but :wq just quits the buffer without saving the file.

Unable to reproduce. I tried the following:

  • Start with
#+BEGIN_SRC emacs-lisp
(message "start-point")

#+END_SRC
  • Press C-c '
  • I get
(message "start-point")
  • Modify this into:
(message "start-point")
(message "edit")
  • Now press :wq

  • The result becomes

#+BEGIN_SRC emacs-lisp
  (message "start-point")
  (message "edit")

#+END_SRC
  • Now press :w one more time to save the original org file.
commented

@Somelauw What I'm saying is I shouldn't have to press :w one more time to save the original org file, :w should save the original file

commented

Calling evil-write interactively from an src block edit results in the message : user-error: Please specify a file name for the buffer. FWIW, I have the following in my init, which does what I want:

    (define-key org-src-mode-map [remap evil-write] 'org-edit-src-save)
    (define-key org-src-mode-map [remap evil-save-and-close]
      (lambda () (interactive)
        (org-edit-src-save)
        (org-edit-src-exit)))
    (define-key org-src-mode-map [remap evil-save-modified-and-close]
      (lambda () (interactive)
        (org-edit-src-save)
        (org-edit-src-exit)))

Calling evil-write interactively from an src block edit results in the message : user-error: Please specify a file name for the buffer.

:w and ZZ both work for me and save the original file.

I'm running the following org-mode version org-plus-contrib 20180604

(define-key org-src-mode-map [remap evil-write] 'org-edit-src-save)

Does this still work when you run :w codeblock.py? This should only save the code in the temporary buffer in a new file codeblock.py. If possible I want to preserve as many features that evil-write originally had as possible.