Skip to content

Commit

Permalink
browser: Simplify external-editor-program API.
Browse files Browse the repository at this point in the history
Handle string values exclusively.
  • Loading branch information
aadcg committed Nov 13, 2023
1 parent 35e6a76 commit 61c57af
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 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 @@ -306,10 +306,9 @@ prevents otherwise.")
(defmethod external-editor-program ((browser browser))
"Specialized reader for `external-editor-program' slot."
(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

0 comments on commit 61c57af

Please sign in to comment.