Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor external editor program api #3253

Merged
merged 2 commits into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions source/browser.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ The handlers take the `prompt-buffer' as argument.")
(or (uiop:getenvp "VISUAL")
(uiop:getenvp "EDITOR")
(when (sera:resolve-executable "gio") "gio open"))
:type (or (cons string *) string null)
:type (or string null)
:reader nil
:writer t
:export t
Expand Down Expand Up @@ -304,12 +304,13 @@ prevents otherwise.")
(make-instance 'theme:theme))

(defmethod external-editor-program ((browser browser))
"Specialized reader for `external-editor-program' slot."
"Specialized reader for `external-editor-program' slot.
A list of strings is returned, as to comply with `uiop:launch-program' or
`uiop:run-program'."
(with-slots ((cmd external-editor-program)) browser
(typecase cmd
(list (unless (sera:blankp (first cmd)) cmd))
(string (unless (sera:blankp cmd) (str:split " " cmd)))
(t (echo-warning "Invalid value of `external-editor-program' browser slot.") nil))))
(if (str:blank? cmd)
(progn (echo-warning "Invalid value of `external-editor-program' browser slot.") nil)
(str:split " " cmd))))

(defmethod get-containing-window-for-buffer ((buffer buffer) (browser browser))
"Get the window containing a buffer."
Expand Down
5 changes: 4 additions & 1 deletion source/migration.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ major versions."
(:p "Deprecated in favor of " (:nxref :slot 'style :class-name 'message-buffer) ".")

(ffi-window-message-buffer-height)
(:p "Deprecated since it is now handled by " (:nxref :function 'ffi-height) "."))
(:p "Deprecated since it is now handled by " (:nxref :function 'ffi-height) ".")

(external-editor-program)
(:p "Deprecated support for lists as a value. Strings are the only valid values."))

(define-migration "3"
(%slot-default)
Expand Down
Loading