d2-mode
d2-mode copied to clipboard
use `xdg-open` on Linux and `open` on macOS instead of browse-url
Debugger entered--Lisp error: (wrong-type-argument commandp d2-open-browser)
call-interactively(d2-open-browser nil nil)
command-execute(d2-open-browser)
I know how to fix it but didn't learn enough emacs-lisp knowledge to achieve it. 🤣
Find a function to open file in default app
;; https://emacs-china.org/t/pdf/14954/5
(defun my/open-with (arg)
"使用外部程序打开浏览的文件或者当前光标下的链接.
处于 dired mode 时, 打开当前光标下的文件;
若当前光标下存在链接,使用外部程序打开链接;
使用 prefix ARG 时指定使用的外部程序."
(interactive "P")
(let ((current-file-name
(cond ((eq major-mode 'dired-mode) (dired-get-file-for-visit))
((help-at-pt-string)
(pcase (cdr (split-string (help-at-pt-string) ":" t " "))
((or `(,path) `(,(pred (string= "file")) ,path) `(,_ ,path ,_))
(expand-file-name path))
(`(,proto ,path) (concat proto ":" path))))
(t (or (thing-at-point 'url) buffer-file-name))))
(program (if arg
(read-shell-command "Open current file with: ")
"open")))
(call-process program nil 0 nil current-file-name)))
Thanks @suliveevil . I can't address this now but will put this on the docket to address as soon as possible.
The same as mine, it still exists.