Skip to content

Instantly share code, notes, and snippets.

@jmercouris
Created December 17, 2017 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmercouris/944e60992fd391fc9008485788342ce6 to your computer and use it in GitHub Desktop.
Save jmercouris/944e60992fd391fc9008485788342ce6 to your computer and use it in GitHub Desktop.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; CURRENT IMPLEMENTATION
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun set-url (input-url &optional disable-history)
(let ((url (parse-url input-url)))
(set-url-buffer url *active-buffer* disable-history)))
(define-key *document-mode-map* (kbd "C-l")
(:input-complete *minibuffer* set-url :setup #'setup-url :empty-complete t))
;; Upon keystroke RET within the minibuffer, function return-input will be invoked which will
;; call (funcall set-url input-from-textbox)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SUGGESTED NEW IMPLEMENTATION
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defcommand set-url ()
"Some docstring describing the command"
(let ((url ((read-from-minibuffer
:setup setup-url
:empty-complete t))))
(set-url-buffer url *active-buffer* disable-history)))
;; read-from-minibuffer is a blocking function Upon keystroke RET,
;; semaphore is signaled unblocking read-from-minibuffer returning the
;; current value contained within the minibufffer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment