mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-05 09:01:40 -05:00
Use completing-read instead of ido-completing-read. (#514)
* Use completing-read instead of ido-completing-read. Per @seagle0128 and issue #496. * lisp/ein-notebook.el: * Wrap all calls to completing-read with ein:completing-read Use `ein:completing-read' everywhere we need to do completion as it wraps Emacs completing-read functionality and tries to use sane defaults.
This commit is contained in:
parent
b08aed3a85
commit
70845a3411
8 changed files with 23 additions and 16 deletions
|
@ -66,7 +66,7 @@
|
|||
(let* ((end (point))
|
||||
(beg (ein:completer-beginning matched-text))
|
||||
(word (if (and beg matches)
|
||||
(completing-read "Complete: " matches
|
||||
(ein:completing-read "Complete: " matches
|
||||
nil nil matched-text))))
|
||||
(when word
|
||||
(delete-region beg end)
|
||||
|
|
|
@ -182,7 +182,7 @@ notebooks."
|
|||
;;;###autoload
|
||||
(defun ein:connect-to-notebook-buffer (buffer-or-name)
|
||||
"Connect any buffer to opened notebook and its kernel."
|
||||
(interactive (list (completing-read "Notebook buffer to connect: "
|
||||
(interactive (list (ein:completing-read "Notebook buffer to connect: "
|
||||
(ein:notebook-opened-buffer-names))))
|
||||
(ein:aif (get-buffer buffer-or-name)
|
||||
(let ((notebook (buffer-local-value 'ein:%notebook% it)))
|
||||
|
|
|
@ -49,7 +49,8 @@
|
|||
(let* ((dir (or dir ein:source-dir))
|
||||
(regex (or regex ".+"))
|
||||
(files (-remove #'(lambda (x)
|
||||
(string-match-p "ein-pkg\\.el" x))
|
||||
(or (string-match-p "ein-pkg\\.el" x)
|
||||
(string-match-p "ein-smartrep\\.el" x)))
|
||||
(and
|
||||
(file-accessible-directory-p dir)
|
||||
(directory-files dir 'full regex)))))
|
||||
|
|
|
@ -465,7 +465,7 @@ of minor mode."
|
|||
(interactive
|
||||
(list (or (ein:get-notebook)
|
||||
(ein:aand (ein:notebook-opened-buffer-names)
|
||||
(with-current-buffer (ido-completing-read
|
||||
(with-current-buffer (ein:completing-read
|
||||
"Notebook: " it nil t)
|
||||
(ein:get-notebook))))))
|
||||
(when (and (ein:$notebook-q-checkpoints notebook)
|
||||
|
@ -484,7 +484,7 @@ of minor mode."
|
|||
(interactive
|
||||
(list (or (ein:get-notebook)
|
||||
(ein:aand (ein:notebook-opened-buffer-names)
|
||||
(with-current-buffer (ido-completing-read
|
||||
(with-current-buffer (ein:completing-read
|
||||
"Notebook: " it nil t)
|
||||
(ein:get-notebook))))))
|
||||
(if (and notebook (ein:$notebook-autosave-timer notebook))
|
||||
|
@ -500,7 +500,7 @@ notebook buffer."
|
|||
(list (read-number "New autosaves frequency (0 to disable): ")
|
||||
(or (ein:get-notebook)
|
||||
(ein:aand (ein:notebook-opened-buffer-names)
|
||||
(with-current-buffer (ido-completing-read
|
||||
(with-current-buffer (ein:completing-read
|
||||
"Notebook: " it nil t)
|
||||
(ein:get-notebook))))))
|
||||
(if notebook
|
||||
|
@ -562,10 +562,10 @@ notebook buffer."
|
|||
notebook buffer then the user will be prompted to select an opened notebook."
|
||||
(interactive
|
||||
(let* ((notebook (or (ein:get-notebook)
|
||||
(ido-completing-read
|
||||
(ein:completing-read
|
||||
"Select notebook: "
|
||||
(ein:notebook-opened-buffer-names))))
|
||||
(kernel-name (ido-completing-read
|
||||
(kernel-name (ein:completing-read
|
||||
"Select kernel: "
|
||||
(ein:list-available-kernels (ein:$notebook-url-or-port notebook)))))
|
||||
(list notebook kernel-name)))
|
||||
|
@ -990,7 +990,7 @@ server. Note that if there are multiple checkpoints the user will
|
|||
be prompted on which one to use."
|
||||
(interactive
|
||||
(let* ((notebook (ein:get-notebook))
|
||||
(checkpoint (completing-read
|
||||
(checkpoint (ein:completing-read
|
||||
"Select checkpoint: "
|
||||
(ein:notebook-list-checkpoint-ids notebook))))
|
||||
(list notebook checkpoint)))
|
||||
|
|
|
@ -226,7 +226,7 @@ This function adds NBLIST to `ein:notebooklist-map'."
|
|||
(ein:crib-running-servers)))))
|
||||
(url-or-port (let ((ido-report-no-match nil)
|
||||
(ido-use-faces nil))
|
||||
(ido-completing-read "URL or port: "
|
||||
(ein:completing-read "URL or port: "
|
||||
url-or-port-list
|
||||
nil nil nil nil
|
||||
default))))
|
||||
|
@ -371,7 +371,7 @@ This function is called via `ein:notebook-after-rename-hook'."
|
|||
;;;###autoload
|
||||
(defun ein:notebooklist-new-notebook (url-or-port kernelspec &optional callback no-pop retry)
|
||||
(interactive (list (ein:notebooklist-ask-url-or-port)
|
||||
(ido-completing-read
|
||||
(ein:completing-read
|
||||
"Select kernel: "
|
||||
(ein:list-available-kernels
|
||||
(ein:$notebooklist-url-or-port ein:%notebooklist%))
|
||||
|
@ -426,7 +426,7 @@ This function is called via `ein:notebook-after-rename-hook'."
|
|||
(interactive
|
||||
(let* ((url-or-port (or (ein:get-url-or-port)
|
||||
(ein:default-url-or-port)))
|
||||
(kernelspec (ido-completing-read
|
||||
(kernelspec (ein:completing-read
|
||||
"Select kernel: "
|
||||
(ein:list-available-kernels url-or-port)
|
||||
nil t nil nil "default" nil))
|
||||
|
@ -771,7 +771,7 @@ Notebook list data is passed via the buffer local variable
|
|||
:error)))
|
||||
|
||||
(defsubst ein:notebooklist-ask-path (&optional content-type)
|
||||
(ido-completing-read (format "Open %s: " content-type)
|
||||
(ein:completing-read (format "Open %s: " content-type)
|
||||
(ein:notebooklist-list-paths content-type)
|
||||
nil t))
|
||||
|
||||
|
|
|
@ -300,10 +300,10 @@ Generated by `ein:header-line-define-mouse-commands'" slot)
|
|||
(defun ein:header-line-switch-kernel (key-event)
|
||||
(interactive "e")
|
||||
(let* ((notebook (or (ein:get-notebook)
|
||||
(ido-completing-read
|
||||
(ein:completing-read
|
||||
"Select notebook: "
|
||||
(ein:notebook-opened-buffer-names))))
|
||||
(kernel-name (ido-completing-read
|
||||
(kernel-name (ein:completing-read
|
||||
"Select kernel: "
|
||||
(ein:list-available-kernels (ein:$notebook-url-or-port notebook)))))
|
||||
(ein:notebook-switch-kernel notebook kernel-name)))
|
||||
|
|
|
@ -372,7 +372,7 @@ Currently EIN/IPython supports exporting to the following formats:
|
|||
|
||||
.. _nbconvert: http://ipython.org/ipython-doc/stable/notebook/nbconvert.html"
|
||||
(interactive (list (read-buffer "Buffer: " (current-buffer) t)
|
||||
(completing-read "Export format: "
|
||||
(ein:completing-read "Export format: "
|
||||
(list "html"
|
||||
"json"
|
||||
"latex"
|
||||
|
|
|
@ -410,6 +410,12 @@ Adapted from twittering-mode.el's `case-string'."
|
|||
|
||||
;;; Misc
|
||||
|
||||
(defun ein:completing-read (&rest args)
|
||||
"Wrap for emacs completing read functionality. Unless a more sophisticated completion framework has been installed (like helm or ivy), this function will default to using the slightly more sane ido completion framework. Arguments are the same as for `completing-read'."
|
||||
(if (eq completing-read-function 'completing-read-default)
|
||||
(apply #'ido-completing-read args)
|
||||
(apply completing-read-function args)))
|
||||
|
||||
(defun ein:plist-iter (plist)
|
||||
"Return list of (key . value) in PLIST."
|
||||
;; FIXME: this is not needed. See: `ein:plist-exclude'.
|
||||
|
|
Loading…
Add table
Reference in a new issue