A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/jrblevin/markdown-mode/issues/248 below:

Save buffer before executing `markdown-open-command` · Issue #248 · jrblevin/markdown-mode · GitHub

I would suggest some small improvements to the markdown-open command. The version below will first save the buffer content using (save-buffer (buffer-file-name)) and then run the markdown-open-command on the file.

(defun markdown-open ()
  "Open file for the current buffer with `markdown-open-command'."
  (interactive)
  (if (not markdown-open-command)
      (user-error "Variable `markdown-open-command' must be set")
    (if (not buffer-file-name)
        (user-error "Must be visiting a file")
      (save-buffer (buffer-file-name))
      (call-process markdown-open-command
                    nil nil nil buffer-file-name))))

For the time being you could advise the markdown-open function:

(defadvice markdown-open (before my-markdown-save-and-open activate)
  "Save buffer before open file for the current buffer."
  (unless (buffer-file-name) (user-error "Must be visiting a file"))
  (save-buffer (buffer-file-name)))

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4