Skip to content

Instantly share code, notes, and snippets.

@jmercouris
Created December 17, 2017 17:52
Show Gist options
  • Save jmercouris/9bcb9d0dc666c92189b5559811d89fb4 to your computer and use it in GitHub Desktop.
Save jmercouris/9bcb9d0dc666c92189b5559811d89fb4 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 history-typed-complete :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
:completion history-typed-complete
: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