Skip to content

Instantly share code, notes, and snippets.

@oantolin
Created December 3, 2014 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oantolin/1846eef35ec49c359b69 to your computer and use it in GitHub Desktop.
Save oantolin/1846eef35ec49c359b69 to your computer and use it in GitHub Desktop.
Turn off openwith-mode for certain commands
(defun turn-off-openwith-mode (orig-fun &rest args)
"Ensure openwtih-mode is off when running dired-mark-files-containing-regexp"
(let ((openwith-mode-on? openwith-mode))
(when openwith-mode-on? (openwith-mode -1))
(apply orig-fun args)
(when openwith-mode-on? (openwith-mode 1))))
(dolist (cmd '(dired-mark-files-containing-regexp message-send-and-exit))
(advice-add cmd :around #'turn-off-openwith-mode))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment