elisp - Emacs: open large files in external apps automatically -
i use emacs file manager , open large file (in dired or speedbar) xdg-open
. can use defadvice
abort-if-file-too-large
function , how correctly?
advising abort-if-file-too-large
requires still raise error if opens file externally, otherwise find-file-noselect
still try open file. also, want call external program when operation type passed abort-if-file-too-large
indicates file being opened. following work, though might want tweak arguments call-process
make fit scenario better:
(defun open-outside-emacs (orig-fun size op-type filename) (if (not (string-equal op-type "open")) (apply orig-fun size op-type filename) (call-process "/usr/bin/xdg-open" nil 0 nil (expand-file-name filename)) (error "opened externally"))) (advice-add 'abort-if-file-too-large :around #'open-outside-emacs)
Comments
Post a Comment