Introduce an ee-app-info-function customisation
This commit is contained in:
parent
bdc0ec3ff4
commit
2109b78cca
|
@ -227,6 +227,20 @@ Make sure that it will be matched by `emacs-everywhere-file-patterns'."
|
||||||
:type 'function
|
:type 'function
|
||||||
:group 'emacs-everywhere)
|
:group 'emacs-everywhere)
|
||||||
|
|
||||||
|
(defcustom emacs-everywhere-app-info-function
|
||||||
|
(pcase emacs-everywhere--display-server
|
||||||
|
(`(quartz . ,_) (emacs-everywhere--app-info-osx))
|
||||||
|
(`(windows . ,_) (emacs-everywhere--app-info-windows))
|
||||||
|
(`(x11 . ,_) (emacs-everywhere--app-info-linux-x11))
|
||||||
|
(`(wayland . KDE) (emacs-everywhere--app-info-linux-kde)))
|
||||||
|
"Function that asks the system for information on the current foreground app.
|
||||||
|
On most systems, this should be set to a sensible default, but it
|
||||||
|
may not be set on less common configurations. If unset, a custom
|
||||||
|
app-info function can be used — see the various
|
||||||
|
emacs-everywhere--app-info-* functions for reference."
|
||||||
|
:type 'function
|
||||||
|
:group 'emacs-everywhere)
|
||||||
|
|
||||||
;; Semi-internal variables
|
;; Semi-internal variables
|
||||||
|
|
||||||
(defconst emacs-everywhere-osascript-accessibility-error-message
|
(defconst emacs-everywhere-osascript-accessibility-error-message
|
||||||
|
@ -429,20 +443,19 @@ Never paste content when ABORT is non-nil."
|
||||||
id class title geometry)
|
id class title geometry)
|
||||||
|
|
||||||
(defun emacs-everywhere-app-info ()
|
(defun emacs-everywhere-app-info ()
|
||||||
"Return information on the active window."
|
"Return information on the active window.
|
||||||
(let ((w (pcase system-type
|
This runs `emacs-everywhere-app-info-function' and lightly reformats the app title."
|
||||||
(`darwin (emacs-everywhere--app-info-osx))
|
(if (functionp emacs-everywhere-app-info-function)
|
||||||
((or `ms-dos `windows-nt `cygwin)
|
(let ((w (funcall emacs-everywhere-app-info-function)))
|
||||||
(emacs-everywhere--app-info-windows))
|
(setf (emacs-everywhere-app-title w)
|
||||||
(_ (emacs-everywhere--app-info-linux)))))
|
(replace-regexp-in-string
|
||||||
(setf (emacs-everywhere-app-title w)
|
(format " ?-[A-Za-z0-9 ]*%s"
|
||||||
(replace-regexp-in-string
|
(regexp-quote (emacs-everywhere-app-class w)))
|
||||||
(format " ?-[A-Za-z0-9 ]*%s"
|
""
|
||||||
(regexp-quote (emacs-everywhere-app-class w)))
|
(replace-regexp-in-string
|
||||||
""
|
"[^[:ascii:]]+" "-" (emacs-everywhere-app-title w))))
|
||||||
(replace-regexp-in-string
|
w))
|
||||||
"[^[:ascii:]]+" "-" (emacs-everywhere-app-title w))))
|
(user-error "No app-info function is set, see `emacs-everywhere-app-info-function'"))
|
||||||
w))
|
|
||||||
|
|
||||||
(defun emacs-everywhere--call (command &rest args)
|
(defun emacs-everywhere--call (command &rest args)
|
||||||
"Execute COMMAND with ARGS synchronously."
|
"Execute COMMAND with ARGS synchronously."
|
||||||
|
|
Loading…
Reference in New Issue