summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/custom-buffer-file.el9
-rw-r--r--modules/external-open.el7
-rw-r--r--modules/system-utils.el6
3 files changed, 12 insertions, 10 deletions
diff --git a/modules/custom-buffer-file.el b/modules/custom-buffer-file.el
index 92e73c3d..f99a0ee4 100644
--- a/modules/custom-buffer-file.el
+++ b/modules/custom-buffer-file.el
@@ -32,6 +32,7 @@
;; mm-decode for email viewing (mm-handle-type is a macro, needs early require)
(require 'mm-decode)
+(require 'external-open) ;; for cj/xdg-open, cj/open-this-file-with
;; cj/kill-buffer-and-window defined in undead-buffers.el
(declare-function cj/kill-buffer-and-window "undead-buffers")
@@ -446,7 +447,9 @@ Signals an error if:
"S" #'write-file ;; save as
"g" #'revert-buffer
"w" #'cj/view-buffer-in-eww
- "e" #'cj/view-email-in-buffer)
+ "e" #'cj/view-email-in-buffer
+ "o" #'cj/xdg-open
+ "O" #'cj/open-this-file-with)
(when (boundp 'cj/custom-keymap)
(keymap-set cj/custom-keymap "b" cj/buffer-and-file-map))
@@ -473,7 +476,9 @@ Signals an error if:
"C-; b S" "save as"
"C-; b g" "revert buffer"
"C-; b w" "view in EWW"
- "C-; b e" "view email"))
+ "C-; b e" "view email"
+ "C-; b o" "open with default app"
+ "C-; b O" "open with program..."))
(provide 'custom-buffer-file)
diff --git a/modules/external-open.el b/modules/external-open.el
index 8c4db810..71318e27 100644
--- a/modules/external-open.el
+++ b/modules/external-open.el
@@ -90,7 +90,6 @@
:group 'external-open)
;; ------------------------------- Open File With ------------------------------
-;; TASK: Add this to buffer custom functions
(defun cj/open-this-file-with (command)
"Open this buffer's file with COMMAND, detached from Emacs."
@@ -109,12 +108,6 @@
command (shell-quote-argument file))
nil 0)))))
-(keymap-global-set "C-c x o" #'cj/open-this-file-with)
-
-(with-eval-after-load 'which-key
- (which-key-add-key-based-replacements
- "C-c x" "external open menu"
- "C-c x o" "open file with"))
;; -------------------- Open Files With Default File Handler -------------------
diff --git a/modules/system-utils.el b/modules/system-utils.el
index 1bd7f015..29076f6d 100644
--- a/modules/system-utils.el
+++ b/modules/system-utils.el
@@ -106,7 +106,11 @@ Signals an error if the host is unsupported."
"Open FILENAME (or the file at point) with the OS default handler.
Logs output and exit code to buffer *external-open.log*."
(interactive)
- (let* ((file (expand-file-name (or filename (dired-file-name-at-point))))
+ (let* ((file (expand-file-name
+ (or filename
+ buffer-file-name
+ (and (derived-mode-p 'dired-mode) (dired-file-name-at-point))
+ (user-error "No file associated with this buffer"))))
(cmd (cj/identify-external-open-command))
(logbuf (get-buffer-create "*external-open.log*")))
(with-current-buffer logbuf