* bug#21644: 24.4; completing-read acts differently on functional collection [not found] ` <<837fmn6tb3.fsf@gnu.org> @ 2015-10-16 15:53 ` Drew Adams 0 siblings, 0 replies; 24+ messages in thread From: Drew Adams @ 2015-10-16 15:53 UTC (permalink / raw) To: Eli Zaretskii, Dmitry Gutov; +Cc: 21644, rct, ohwoeowho > > > It is a bug (IMHO) that the node that documents `completing-read' > > > does not specify parameter COLLECTION - which is arguably the > > > *most important* parameter. > > Done. > I also re-added the references to the completion functions into the > doc string of completing-read (and added 2 more functions to that > list). While referencing the manual is good, especially for complex > topics, I feel that the absolute minimum of usage information, > including the arguments with which callbacks can be called, should be > available from the doc strings. Great. Thx. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection @ 2015-10-07 22:55 Ryan C. Thompson 2015-10-08 10:13 ` Oleh Krehel 0 siblings, 1 reply; 24+ messages in thread From: Ryan C. Thompson @ 2015-10-07 22:55 UTC (permalink / raw) To: 21644 I've discovered that completing-read works differently if COLLECTION is a function than if it is a list, even if the function represents exactly the same set of completions as the list. For example, we can define a function to convert any collection to an equivalent function using a closure: (setq lexical-binding t) (defun collection-as-function (collection) "Return a function equivalent to COLLECTION. The returned function will work equivalently to COLLECTION when passed to `all-completions' and `try-completion'." (if (functionp collection) collection ;; Capture collection in a closure (lambda (string pred all) (funcall (if all #'all-completions #'try-completion) string collection pred)))) collection-as-function (completing-read "Prompt: " '("blue" "yellow" "green") nil t) (completing-read "Prompt: " (collection-as-function '("blue" "yellow" "green")) nil t) Try typing "g" followed by RET for both of the above. In the first case (collection is a list), it returns "green". In the second case (collection is a function), it returns just "g". This is reproducible in emacs -Q. In GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2015-03-21 on kissel, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.11701000 System Description: Ubuntu 15.04 Configured using: `configure --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp --with-x=yes --with-x-toolkit=lucid --with-toolkit-scroll-bars --without-gconf --without-gsettings 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall' CPPFLAGS=-D_FORTIFY_SOURCE=2 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'' Important settings: value of $LC_COLLATE: en_US.UTF-8 value of $LC_CTYPE: en_US.UTF-8 value of $LC_MESSAGES: en_US.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Emacs-Lisp Minor modes in effect: recentf-mode: t ws-butler-global-mode: t ws-butler-mode: t winner-mode: t sml-modeline-mode: t savehist-mode: t minibuffer-electric-default-mode: t minibuffer-depth-indicate-mode: t ido-yes-or-no-mode: t icomplete-mode: t global-undo-tree-mode: t undo-tree-mode: t global-pointback-mode: t pointback-mode: t global-hl-line-mode: t global-anzu-mode: t anzu-mode: t desktop-save-mode: t delete-selection-mode: t auto-dim-other-buffers-mode: t git-wip-mode: t ido-complete-space-or-hyphen-mode: t pretty-symbols-mode: t diff-auto-refine-mode: t global-git-commit-mode: t lexbind-mode: t highlight-defined-mode: t global-git-gutter-mode: t git-gutter-mode: t ido-everywhere: t shell-dirtrack-mode: t eldoc-mode: t autopair-global-mode: t autopair-mode: t show-paren-mode: t global-auto-complete-mode: t auto-complete-mode: t adjust-parens-mode: t override-global-mode: t tooltip-mode: t electric-indent-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: C-_ C-x C-e <down> <up> <left> C-x C-e g <tab> <backspace> <backspace> <backspace> <backspace> <backspace> g <return> C-a <tab> C-M-S-f M-w C-e <return> <return> C-y <C-left> <C-left> <C-left> <C-left> <C-left> <C-left> <C-right> <right> <C-S-left> <C-S-left> <C-S-left> <S-left> <backspace> C-e <left> <left> <left> <left> <left> <backspace> C-e C-j g <return> M-x i d o - u <tab> b <tab> - m o <return> <left> C-_ C-j g <return> C-_ <up> <up> <tab> <tab> C-a <tab> C-M-S-f M-w <down> <return> C-y C-j g <return> <down> <down> C-e C-j g <return> <down-mouse-1> <mouse-1> ( u n e <backspace> l e s s SPC ( f u n c t i o n <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> C-x C-s <down-mouse-4> <mouse-4> <double-down-mouse-4> <double-mouse-4> <triple-down-mouse-4> <triple-mouse-4> <triple-down-mouse-4> <triple-mouse-4> <triple-down-mouse-4> <triple-mouse-4> <down-mouse-1> <mouse-1> C-a <C-S-down> <C-S-down> M-w <C-S-up> <S-up> <S-up> M-w <help-echo> <help-echo> <down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> C-a <up> <up> <down> <C-S-down> <C-S-down> M-w <help-echo> <help-echo> <help-echo> <help-echo> <help-echo> <help-echo> <down-mouse-1> <mouse-1> C-a <C-S-down> <C-S-down> <up> <down> C-_ C-_ C-_ C-a <C-S-down> <C-S-down> M-w <down-mouse-1> <mouse-1> M-x r e p o r t <return> <down> <up> <down> <down> <up> <up> M-x <return> M-x r e p o r t - e m a c s <tab> <return> c o m p l e t i n g - r e a d SPC a c t s SPC d i f f e r e n t l y SPC o n SPC f u n c t i o n a l SPC c o l l e c t i o n <return> M-x r e p o r C-g C-g C-x k <return> <return> M-x r e p o r - v i a - m a i l <return> Recent messages: Checking 261 files in /usr/share/emacs/24.4/lisp/gnus... Checking 57 files in /usr/share/emacs/24.4/lisp/eshell... Checking 70 files in /usr/share/emacs/24.4/lisp/erc... Checking 48 files in /usr/share/emacs/24.4/lisp/emulation... Checking 151 files in /usr/share/emacs/24.4/lisp/emacs-lisp... Checking 24 files in /usr/share/emacs/24.4/lisp/cedet... Checking 57 files in /usr/share/emacs/24.4/lisp/calendar... Checking 87 files in /usr/share/emacs/24.4/lisp/calc... Checking 95 files in /usr/share/emacs/24.4/lisp/obsolete... Checking for load-path shadows...done Quit [2 times] Load-path shadows: /home/ryan/.emacs.d/el-get/ido-completing-read+/ido-completing-read+ hides /home/ryan/.emacs.d/.cask/24.4.1/elpa/ido-completing-read+-20151005.2131/ido-completing-read+ /home/ryan/.emacs.d/el-get/tempbuf/tempbuf hides /home/ryan/.emacs.d/.cask/24.4.1/elpa/tempbuf-20111124.1307/tempbuf /home/ryan/.emacs.d/.cask/24.4.1/elpa/bar-cursor-1.1/bar-cursor hides /usr/share/emacs24/site-lisp/emacs-goodies-el/bar-cursor /home/ryan/.emacs.d/.cask/24.4.1/elpa/apache-mode-20140625.1556/apache-mode hides /usr/share/emacs24/site-lisp/emacs-goodies-el/apache-mode /home/ryan/.emacs.d/.cask/24.4.1/elpa/markdown-mode-20150628.502/markdown-mode hides /usr/share/emacs24/site-lisp/emacs-goodies-el/markdown-mode /home/ryan/.emacs.d/.cask/24.4.1/elpa/keydef-20090428.1231/keydef hides /usr/share/emacs24/site-lisp/emacs-goodies-el/keydef /home/ryan/.emacs.d/.cask/24.4.1/elpa/diminish-20091203.1012/diminish hides /usr/share/emacs24/site-lisp/emacs-goodies-el/diminish /home/ryan/.emacs.d/.cask/24.4.1/elpa/debian-changelog-mode-1.96/debian-changelog-mode hides /usr/share/emacs24/site-lisp/dpkg-dev-el/debian-changelog-mode /usr/share/emacs/24.4/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup /usr/share/emacs24/site-lisp/cmake-data/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode /usr/share/emacs24/site-lisp/flim/md4 hides /usr/share/emacs/24.4/lisp/md4 /usr/share/emacs24/site-lisp/flim/hex-util hides /usr/share/emacs/24.4/lisp/hex-util /home/ryan/.emacs.d/el-get/ido-mode-el/ido hides /usr/share/emacs/24.4/lisp/ido /usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.4/lisp/textmodes/flyspell /usr/share/emacs24/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.4/lisp/textmodes/ispell /usr/share/emacs/site-lisp/rst hides /usr/share/emacs/24.4/lisp/textmodes/rst /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-ctags hides /usr/share/emacs/24.4/lisp/org/org-ctags /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-eval hides /usr/share/emacs/24.4/lisp/org/ob-eval /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-docview hides /usr/share/emacs/24.4/lisp/org/org-docview /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-awk hides /usr/share/emacs/24.4/lisp/org/ob-awk /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-screen hides /usr/share/emacs/24.4/lisp/org/ob-screen /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-sql hides /usr/share/emacs/24.4/lisp/org/ob-sql /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-mscgen hides /usr/share/emacs/24.4/lisp/org/ob-mscgen /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ox-md hides /usr/share/emacs/24.4/lisp/org/ox-md /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-list hides /usr/share/emacs/24.4/lisp/org/org-list /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-perl hides /usr/share/emacs/24.4/lisp/org/ob-perl /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-attach hides /usr/share/emacs/24.4/lisp/org/org-attach /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-js hides /usr/share/emacs/24.4/lisp/org/ob-js /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-w3m hides /usr/share/emacs/24.4/lisp/org/org-w3m /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ox-org hides /usr/share/emacs/24.4/lisp/org/ox-org /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ox-texinfo hides /usr/share/emacs/24.4/lisp/org/ox-texinfo /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-id hides /usr/share/emacs/24.4/lisp/org/org-id /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-ocaml hides /usr/share/emacs/24.4/lisp/org/ob-ocaml /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-sqlite hides /usr/share/emacs/24.4/lisp/org/ob-sqlite /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-plantuml hides /usr/share/emacs/24.4/lisp/org/ob-plantuml /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-entities hides /usr/share/emacs/24.4/lisp/org/org-entities /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-agenda hides /usr/share/emacs/24.4/lisp/org/org-agenda /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ox-beamer hides /usr/share/emacs/24.4/lisp/org/ox-beamer /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-exp hides /usr/share/emacs/24.4/lisp/org/ob-exp /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-install hides /usr/share/emacs/24.4/lisp/org/org-install /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-mobile hides /usr/share/emacs/24.4/lisp/org/org-mobile /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-emacs-lisp hides /usr/share/emacs/24.4/lisp/org/ob-emacs-lisp /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-lob hides /usr/share/emacs/24.4/lisp/org/ob-lob /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-feed hides /usr/share/emacs/24.4/lisp/org/org-feed /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-python hides /usr/share/emacs/24.4/lisp/org/ob-python /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ox-latex hides /usr/share/emacs/24.4/lisp/org/ox-latex /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-crypt hides /usr/share/emacs/24.4/lisp/org/org-crypt /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-calc hides /usr/share/emacs/24.4/lisp/org/ob-calc /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-table hides /usr/share/emacs/24.4/lisp/org/ob-table /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-picolisp hides /usr/share/emacs/24.4/lisp/org/ob-picolisp /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob hides /usr/share/emacs/24.4/lisp/org/ob /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-shen hides /usr/share/emacs/24.4/lisp/org/ob-shen /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-gnuplot hides /usr/share/emacs/24.4/lisp/org/ob-gnuplot /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ox-html hides /usr/share/emacs/24.4/lisp/org/ox-html /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-dot hides /usr/share/emacs/24.4/lisp/org/ob-dot /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-clojure hides /usr/share/emacs/24.4/lisp/org/ob-clojure /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-pcomplete hides /usr/share/emacs/24.4/lisp/org/org-pcomplete /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-capture hides /usr/share/emacs/24.4/lisp/org/org-capture /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-colview hides /usr/share/emacs/24.4/lisp/org/org-colview /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-fortran hides /usr/share/emacs/24.4/lisp/org/ob-fortran /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-tangle hides /usr/share/emacs/24.4/lisp/org/ob-tangle /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-mouse hides /usr/share/emacs/24.4/lisp/org/org-mouse /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-datetree hides /usr/share/emacs/24.4/lisp/org/org-datetree /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-table hides /usr/share/emacs/24.4/lisp/org/org-table /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-asymptote hides /usr/share/emacs/24.4/lisp/org/ob-asymptote /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-lilypond hides /usr/share/emacs/24.4/lisp/org/ob-lilypond /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-org hides /usr/share/emacs/24.4/lisp/org/ob-org /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ox-man hides /usr/share/emacs/24.4/lisp/org/ox-man /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-sh hides /usr/share/emacs/24.4/lisp/org/ob-sh /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-lisp hides /usr/share/emacs/24.4/lisp/org/ob-lisp /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-compat hides /usr/share/emacs/24.4/lisp/org/org-compat /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-core hides /usr/share/emacs/24.4/lisp/org/ob-core /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-clock hides /usr/share/emacs/24.4/lisp/org/org-clock /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-plot hides /usr/share/emacs/24.4/lisp/org/org-plot /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-ledger hides /usr/share/emacs/24.4/lisp/org/ob-ledger /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-css hides /usr/share/emacs/24.4/lisp/org/ob-css /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-archive hides /usr/share/emacs/24.4/lisp/org/org-archive /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-ref hides /usr/share/emacs/24.4/lisp/org/ob-ref /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-irc hides /usr/share/emacs/24.4/lisp/org/org-irc /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-comint hides /usr/share/emacs/24.4/lisp/org/ob-comint /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ox-odt hides /usr/share/emacs/24.4/lisp/org/ox-odt /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-C hides /usr/share/emacs/24.4/lisp/org/ob-C /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-io hides /usr/share/emacs/24.4/lisp/org/ob-io /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-java hides /usr/share/emacs/24.4/lisp/org/ob-java /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-bbdb hides /usr/share/emacs/24.4/lisp/org/org-bbdb /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-indent hides /usr/share/emacs/24.4/lisp/org/org-indent /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-macro hides /usr/share/emacs/24.4/lisp/org/org-macro /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-protocol hides /usr/share/emacs/24.4/lisp/org/org-protocol /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ox-publish hides /usr/share/emacs/24.4/lisp/org/ox-publish /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-keys hides /usr/share/emacs/24.4/lisp/org/ob-keys /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-element hides /usr/share/emacs/24.4/lisp/org/org-element /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-inlinetask hides /usr/share/emacs/24.4/lisp/org/org-inlinetask /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-bibtex hides /usr/share/emacs/24.4/lisp/org/org-bibtex /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-haskell hides /usr/share/emacs/24.4/lisp/org/ob-haskell /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-faces hides /usr/share/emacs/24.4/lisp/org/org-faces /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-src hides /usr/share/emacs/24.4/lisp/org/org-src /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-gnus hides /usr/share/emacs/24.4/lisp/org/org-gnus /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-sass hides /usr/share/emacs/24.4/lisp/org/ob-sass /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-timer hides /usr/share/emacs/24.4/lisp/org/org-timer /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-scheme hides /usr/share/emacs/24.4/lisp/org/ob-scheme /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-ruby hides /usr/share/emacs/24.4/lisp/org/ob-ruby /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ox-ascii hides /usr/share/emacs/24.4/lisp/org/ox-ascii /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org hides /usr/share/emacs/24.4/lisp/org/org /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-footnote hides /usr/share/emacs/24.4/lisp/org/org-footnote /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-scala hides /usr/share/emacs/24.4/lisp/org/ob-scala /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-habit hides /usr/share/emacs/24.4/lisp/org/org-habit /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-rmail hides /usr/share/emacs/24.4/lisp/org/org-rmail /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-loaddefs hides /usr/share/emacs/24.4/lisp/org/org-loaddefs /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-macs hides /usr/share/emacs/24.4/lisp/org/org-macs /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ox hides /usr/share/emacs/24.4/lisp/org/ox /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-R hides /usr/share/emacs/24.4/lisp/org/ob-R /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-maxima hides /usr/share/emacs/24.4/lisp/org/ob-maxima /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ox-icalendar hides /usr/share/emacs/24.4/lisp/org/ox-icalendar /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-ditaa hides /usr/share/emacs/24.4/lisp/org/ob-ditaa /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-matlab hides /usr/share/emacs/24.4/lisp/org/ob-matlab /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-octave hides /usr/share/emacs/24.4/lisp/org/ob-octave /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-makefile hides /usr/share/emacs/24.4/lisp/org/ob-makefile /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-eshell hides /usr/share/emacs/24.4/lisp/org/org-eshell /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-info hides /usr/share/emacs/24.4/lisp/org/org-info /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/ob-latex hides /usr/share/emacs/24.4/lisp/org/ob-latex /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-mhe hides /usr/share/emacs/24.4/lisp/org/org-mhe /home/ryan/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150629/org-version hides /usr/share/emacs/24.4/lisp/org/org-version /usr/share/emacs24/site-lisp/flim/hmac-def hides /usr/share/emacs/24.4/lisp/net/hmac-def /usr/share/emacs24/site-lisp/flim/sasl-cram hides /usr/share/emacs/24.4/lisp/net/sasl-cram /usr/share/emacs24/site-lisp/flim/ntlm hides /usr/share/emacs/24.4/lisp/net/ntlm /usr/share/emacs24/site-lisp/flim/sasl hides /usr/share/emacs/24.4/lisp/net/sasl /usr/share/emacs24/site-lisp/flim/sasl-digest hides /usr/share/emacs/24.4/lisp/net/sasl-digest /usr/share/emacs24/site-lisp/flim/sasl-ntlm hides /usr/share/emacs/24.4/lisp/net/sasl-ntlm /usr/share/emacs24/site-lisp/flim/hmac-md5 hides /usr/share/emacs/24.4/lisp/net/hmac-md5 Features: (shadow sort mail-extr misearch multi-isearch eieio-opt speedbar sb-image ezimage dframe ert ewoc debug tramp-cache recentf tree-widget imenu emacsbug sendmail saveplace midnight face-remap ws-butler winner sml-modeline savehist minibuf-eldef mb-depth ido-yes-or-no icomplete undo-tree diff pointback assoc hl-line anzu mule-util desktop frameset delsel auto-dim-other-buffers git-wip-mode vc vc-dispatcher ido-complete-space-or-hyphen ido-speed-hack ido-ubiquitous ido-completing-read+ tempbuf flymake parse-time gnutls network-stream starttls url-http tls url-gw url-cache url-auth url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util url-parse url-vars mailcap .loaddefs cus-edit cus-start cus-load wid-edit system-specific-settings smex pretty-symbols osx-pseudo-daemon occur-context-resize noflet cl-indent markdown-mode warnings magit-blame magit-stash magit-bisect magit-remote magit-commit magit-sequence magit magit-log magit-apply magit-wip magit-diff smerge-mode diff-mode magit-core magit-process magit-popup magit-mode magit-git crm magit-section magit-utils git-commit log-edit message rfc822 mml mml-sec mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log with-editor tramp-sh tramp tramp-compat auth-source password-cache tramp-loaddefs trampver server lexbind-mode highlight-defined header2 git-gutter-fringe fringe-helper git-gutter esup esup-child benchmark ido ess-toolbar ess-mouse mouseme thingatpt ess-menu ess-swv ess-noweb ess-bugs-l essd-els ess-sas-d ess-sas-l ess-sas-a shell ess-sta-d ess-sta-l cc-vars cc-defs make-regexp ess-sp6-d ess-sp3-d ess-julia ess-r-d ess-r-completion ess-tracebug ess-roxy hideshow ess-help ess-developer eldoc ess-s-l ess-site ess ess-inf ess-mode ess-noweb-mode ess-utils ess-custom executable ess-compat el-get el-get-autoloading el-get-list-packages el-get-dependencies el-get-build el-get-status pp el-get-methods el-get-fossil el-get-svn el-get-pacman el-get-github-zip el-get-github-tar el-get-http-zip el-get-http-tar el-get-hg el-get-go el-get-git-svn el-get-fink el-get-emacswiki el-get-http el-get-notify help-mode el-get-emacsmirror el-get-github el-get-git el-get-elpa el-get-darcs el-get-cvs el-get-bzr el-get-brew el-get-builtin el-get-apt-get el-get-recipes el-get-byte-compile el-get-custom el-get-core autoload keydef cperl-mode cl-lib-highlight bs browse-url bar-cursor autopair paren auto-complete edmacro kmacro popup apache-mode adjust-parens use-package diminish bind-key compile image-file tabify vc-git org-element org-rmail org-mhe org-irc org-info org-gnus gnus-util org-docview doc-view jka-compr image-mode dired org-bibtex bibtex org-bbdb org-w3m org org-macro org-footnote org-pcomplete pcomplete org-list org-faces org-entities noutline outline org-version ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp org-src ob-keys ob-comint comint ansi-color ring ob-core ob-eval org-compat org-macs org-loaddefs format-spec find-func cal-menu calendar cal-loaddefs pallet advice finder-inf eieio byte-opt bytecomp byte-compile cconv eieio-core cl info easymenu cask cl-macs gv cask-bootstrap package-build mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr json lisp-mnt shut-up epl git commander f dash s ucs-normalize package epg-config cl-loaddefs cl-lib debian-el debian-el-loaddefs emacs-goodies-el emacs-goodies-custom emacs-goodies-loaddefs easy-mmode dpkg-dev-el dpkg-dev-el-loaddefs time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind gfilenotify dynamic-setting font-render-setting x-toolkit x multi-tty emacs) Memory information: ((conses 16 699053 98104) (symbols 48 51690 0) (miscs 40 1022 450) (strings 32 184282 12134) (string-bytes 1 4120459) (vectors 16 78537) (vector-slots 8 2155055 125451) (floats 8 334 652) (intervals 56 7498 244) (buffers 960 48) (heap 1024 61526 7139)) ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-07 22:55 Ryan C. Thompson @ 2015-10-08 10:13 ` Oleh Krehel 2015-10-13 1:23 ` Dmitry Gutov 0 siblings, 1 reply; 24+ messages in thread From: Oleh Krehel @ 2015-10-08 10:13 UTC (permalink / raw) To: Ryan C. Thompson; +Cc: 21644 [-- Attachment #1: Type: text/plain, Size: 532 bytes --] > Try typing "g" followed by RET for both of the above. In the first > case (collection is a list), it returns "green". In the second case > (collection is a function), it returns just "g". This is reproducible > in emacs -Q. I can reproduce this as well, although "TAB RET" works where "RET" doesn't. I attach a patch with a fix. If someone can check it I can push it. The patch doesn't solve all the intricacies of `completion-ignore-case' that were mentioned in that function's comments, just this specific use case. Oleh [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-lisp-minibuffer.el-completion-complete-and-exit-Fix-.patch --] [-- Type: text/x-diff, Size: 6224 bytes --] From 6eca5cbbe328bc035fff41d33b47f03ac5b6ca81 Mon Sep 17 00:00:00 2001 From: Oleh Krehel <ohwoeowho@gmail.com> Date: Thu, 8 Oct 2015 12:05:20 +0200 Subject: [PATCH] lisp/minibuffer.el (completion--complete-and-exit): Fix (bug#21644) When `test-completion' returns a string and `completion-ignore-case' is nil, the result was not used at all and only the minibuffer text was returned. This change makes it use that returned string. --- lisp/minibuffer.el | 96 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 49 insertions(+), 47 deletions(-) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 2814d02..f684164 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1342,56 +1342,58 @@ completion-complete-and-exit (_ nil))))) (defun completion--complete-and-exit (beg end - exit-function completion-function) + exit-function completion-function) "Exit from `require-match' minibuffer. COMPLETION-FUNCTION is called if the current buffer's content does not appear to be a match." - (cond - ;; Allow user to specify null string - ((= beg end) (funcall exit-function)) - ((test-completion (buffer-substring beg end) - minibuffer-completion-table - minibuffer-completion-predicate) - ;; FIXME: completion-ignore-case has various slightly - ;; incompatible meanings. E.g. it can reflect whether the user - ;; wants completion to pay attention to case, or whether the - ;; string will be used in a context where case is significant. - ;; E.g. usually try-completion should obey the first, whereas - ;; test-completion should obey the second. - (when completion-ignore-case - ;; Fixup case of the field, if necessary. - (let* ((string (buffer-substring beg end)) - (compl (try-completion - string - minibuffer-completion-table - minibuffer-completion-predicate))) - (when (and (stringp compl) (not (equal string compl)) - ;; If it weren't for this piece of paranoia, I'd replace - ;; the whole thing with a call to do-completion. - ;; This is important, e.g. when the current minibuffer's - ;; content is a directory which only contains a single - ;; file, so `try-completion' actually completes to - ;; that file. - (= (length string) (length compl))) - (completion--replace beg end compl)))) - (funcall exit-function)) - - ((memq minibuffer-completion-confirm '(confirm confirm-after-completion)) - ;; The user is permitted to exit with an input that's rejected - ;; by test-completion, after confirming her choice. - (if (or (eq last-command this-command) - ;; For `confirm-after-completion' we only ask for confirmation - ;; if trying to exit immediately after typing TAB (this - ;; catches most minibuffer typos). - (and (eq minibuffer-completion-confirm 'confirm-after-completion) - (not (memq last-command minibuffer-confirm-exit-commands)))) - (funcall exit-function) - (minibuffer-message "Confirm") - nil)) - - (t - ;; Call do-completion, but ignore errors. - (funcall completion-function)))) + (cond + ;; Allow user to specify null string + ((= beg end) (funcall exit-function)) + ((test-completion (buffer-substring beg end) + minibuffer-completion-table + minibuffer-completion-predicate) + (let* ((string (buffer-substring beg end)) + (compl (try-completion + string + minibuffer-completion-table + minibuffer-completion-predicate))) + (when (and (stringp compl) + (or (not completion-ignore-case) + ;; FIXME: completion-ignore-case has various slightly + ;; incompatible meanings. E.g. it can reflect whether the user + ;; wants completion to pay attention to case, or whether the + ;; string will be used in a context where case is significant. + ;; E.g. usually try-completion should obey the first, whereas + ;; test-completion should obey the second.d + + ;; Fixup case of the field, if necessary. + (and (not (equal string compl)) + ;; If it weren't for this piece of paranoia, I'd replace + ;; the whole thing with a call to do-completion. + ;; This is important, e.g. when the current minibuffer's + ;; content is a directory which only contains a single + ;; file, so `try-completion' actually completes to + ;; that file. + (= (length string) (length compl))))) + (completion--replace beg end compl))) + (funcall exit-function)) + + ((memq minibuffer-completion-confirm '(confirm confirm-after-completion)) + ;; The user is permitted to exit with an input that's rejected + ;; by test-completion, after confirming her choice. + (if (or (eq last-command this-command) + ;; For `confirm-after-completion' we only ask for confirmation + ;; if trying to exit immediately after typing TAB (this + ;; catches most minibuffer typos). + (and (eq minibuffer-completion-confirm 'confirm-after-completion) + (not (memq last-command minibuffer-confirm-exit-commands)))) + (funcall exit-function) + (minibuffer-message "Confirm") + nil)) + + (t + ;; Call do-completion, but ignore errors. + (funcall completion-function)))) (defun completion--try-word-completion (string table predicate point md) (let ((comp (completion-try-completion string table predicate point md))) -- 2.6.1 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-08 10:13 ` Oleh Krehel @ 2015-10-13 1:23 ` Dmitry Gutov 2015-10-13 1:34 ` Ryan 0 siblings, 1 reply; 24+ messages in thread From: Dmitry Gutov @ 2015-10-13 1:23 UTC (permalink / raw) To: Oleh Krehel, Ryan C. Thompson; +Cc: 21644 On 10/08/2015 01:13 PM, Oleh Krehel wrote: > I can reproduce this as well, although "TAB RET" works where "RET" > doesn't. I attach a patch with a fix. If someone can check it I can push > it. The patch doesn't solve all the intricacies of > `completion-ignore-case' that were mentioned in that function's > comments, just this specific use case. Is there really a bug here? The example code didn't handle `test-completion' (the case when ALL would be `lambda'). With this definition, the behavior is the same in either case: (defun collection-as-function (collection) "Return a function equivalent to COLLECTION. The returned function will work equivalently to COLLECTION when passed to `all-completions' and `try-completion'." (if (functionp collection) collection ;; Capture collection in a closure (lambda (string pred all) (funcall (cond ((eq all 't) #'all-completions) ((eq all 'lambda) #'test-completion) (t #'try-completion)) string collection pred)))) ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-13 1:23 ` Dmitry Gutov @ 2015-10-13 1:34 ` Ryan 2015-10-13 2:27 ` Dmitry Gutov 2015-10-16 13:12 ` Stefan Monnier 0 siblings, 2 replies; 24+ messages in thread From: Ryan @ 2015-10-13 1:34 UTC (permalink / raw) To: Dmitry Gutov, Oleh Krehel; +Cc: 21644 On 10/12/15 6:23 PM, Dmitry Gutov wrote: > On 10/08/2015 01:13 PM, Oleh Krehel wrote: > >> I can reproduce this as well, although "TAB RET" works where "RET" >> doesn't. I attach a patch with a fix. If someone can check it I can push >> it. The patch doesn't solve all the intricacies of >> `completion-ignore-case' that were mentioned in that function's >> comments, just this specific use case. > > Is there really a bug here? > > The example code didn't handle `test-completion' (the case when ALL > would be `lambda'). > > With this definition, the behavior is the same in either case: > > (defun collection-as-function (collection) > "Return a function equivalent to COLLECTION. > > The returned function will work equivalently to COLLECTION when > passed to `all-completions' and `try-completion'." > (if (functionp collection) > collection > ;; Capture collection in a closure > (lambda (string pred all) > (funcall > (cond > ((eq all 't) > #'all-completions) > ((eq all 'lambda) > #'test-completion) > (t > #'try-completion)) > string collection pred)))) > > I wasn't aware of `test-completion'. I was going based on the docstring for `completing-read', which only mentions `try-completion' and `all-completions'. Is there any other documentation I should have consulted? ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-13 1:34 ` Ryan @ 2015-10-13 2:27 ` Dmitry Gutov 2015-10-13 18:59 ` Ryan C. Thompson 2015-10-16 13:12 ` Stefan Monnier 1 sibling, 1 reply; 24+ messages in thread From: Dmitry Gutov @ 2015-10-13 2:27 UTC (permalink / raw) To: Ryan, Oleh Krehel; +Cc: 21644 On 10/13/2015 04:34 AM, Ryan wrote: > I wasn't aware of `test-completion'. I was going based on the docstring > for `completing-read', which only mentions `try-completion' and > `all-completions'. Maybe it should mention test-completion as well. completion-table-with-predicate does. > Is there any other documentation I should have > consulted? (info "(elisp) Programmed Completion") or (info "(elisp) Basic Completion"), probably. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-13 2:27 ` Dmitry Gutov @ 2015-10-13 18:59 ` Ryan C. Thompson 2015-10-15 5:12 ` Dmitry Gutov 0 siblings, 1 reply; 24+ messages in thread From: Ryan C. Thompson @ 2015-10-13 18:59 UTC (permalink / raw) To: Dmitry Gutov, Oleh Krehel; +Cc: 21644 On 10/12/2015 07:27 PM, Dmitry Gutov wrote: > On 10/13/2015 04:34 AM, Ryan wrote: > >> I wasn't aware of `test-completion'. I was going based on the docstring >> for `completing-read', which only mentions `try-completion' and >> `all-completions'. > > Maybe it should mention test-completion as well. > completion-table-with-predicate does. > >> Is there any other documentation I should have >> consulted? > > (info "(elisp) Programmed Completion") or > (info "(elisp) Basic Completion"), probably. Maybe the `completing-read' docstring should link to these info nodes. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-13 18:59 ` Ryan C. Thompson @ 2015-10-15 5:12 ` Dmitry Gutov 2015-10-15 5:17 ` Ryan 2015-10-15 15:01 ` Drew Adams 0 siblings, 2 replies; 24+ messages in thread From: Dmitry Gutov @ 2015-10-15 5:12 UTC (permalink / raw) To: Ryan C. Thompson, Oleh Krehel; +Cc: 21644 On 10/13/2015 09:59 PM, Ryan C. Thompson wrote: >> (info "(elisp) Programmed Completion") or >> (info "(elisp) Basic Completion"), probably. > Maybe the `completing-read' docstring should link to these info nodes. This seems like it should suffice. Do you agree? diff --git a/src/minibuf.c b/src/minibuf.c index 4e5c17d..2cde8b0 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1595,7 +1595,7 @@ PROMPT is a string to prompt with; normally it ends in a colon and a space. COLLECTION can be a list of strings, an alist, an obarray or a hash table. COLLECTION can also be a function to do the completion itself. PREDICATE limits completion to a subset of COLLECTION. -See `try-completion' and `all-completions' for more details +See Info node `(elisp)Basic Completion' for more details on completion, COLLECTION, and PREDICATE. REQUIRE-MATCH can take the following values: ^ permalink raw reply related [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-15 5:12 ` Dmitry Gutov @ 2015-10-15 5:17 ` Ryan 2015-10-15 9:18 ` Dmitry Gutov 2015-10-15 15:01 ` Drew Adams 1 sibling, 1 reply; 24+ messages in thread From: Ryan @ 2015-10-15 5:17 UTC (permalink / raw) To: Dmitry Gutov; +Cc: 21644, Oleh Krehel On 10/14/15 10:12 PM, Dmitry Gutov wrote: > On 10/13/2015 09:59 PM, Ryan C. Thompson wrote: > >>> (info "(elisp) Programmed Completion") or >>> (info "(elisp) Basic Completion"), probably. >> Maybe the `completing-read' docstring should link to these info nodes. > > This seems like it should suffice. Do you agree? > > diff --git a/src/minibuf.c b/src/minibuf.c > index 4e5c17d..2cde8b0 100644 > --- a/src/minibuf.c > +++ b/src/minibuf.c > @@ -1595,7 +1595,7 @@ PROMPT is a string to prompt with; normally it > ends in a colon and a space. > COLLECTION can be a list of strings, an alist, an obarray or a hash > table. > COLLECTION can also be a function to do the completion itself. > PREDICATE limits completion to a subset of COLLECTION. > -See `try-completion' and `all-completions' for more details > +See Info node `(elisp)Basic Completion' for more details > on completion, COLLECTION, and PREDICATE. > > REQUIRE-MATCH can take the following values: > Yes, I think that should be fine. That would have certainly solved the problem in my case, since I would have known to implement the `test-completion' case. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-15 5:17 ` Ryan @ 2015-10-15 9:18 ` Dmitry Gutov 0 siblings, 0 replies; 24+ messages in thread From: Dmitry Gutov @ 2015-10-15 9:18 UTC (permalink / raw) To: Ryan; +Cc: 21644-done, Oleh Krehel On 10/15/2015 08:17 AM, Ryan wrote: > Yes, I think that should be fine. That would have certainly solved the > problem in my case, since I would have known to implement the > `test-completion' case. Good, installed. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-15 5:12 ` Dmitry Gutov 2015-10-15 5:17 ` Ryan @ 2015-10-15 15:01 ` Drew Adams 2015-10-15 15:24 ` Dmitry Gutov 1 sibling, 1 reply; 24+ messages in thread From: Drew Adams @ 2015-10-15 15:01 UTC (permalink / raw) To: Dmitry Gutov, Ryan C. Thompson, Oleh Krehel; +Cc: 21644 > >> (info "(elisp) Programmed Completion") or > >> (info "(elisp) Basic Completion"), probably. > > Maybe the `completing-read' docstring should link to these info nodes. > > This seems like it should suffice. Do you agree? > +See Info node `(elisp)Basic Completion' for more details > on completion, COLLECTION, and PREDICATE. Yes and no, IMO. `Basic Completion' certainly provides some information about "completion, COLLECTION, and PREDICATE." But for 3 other functions, not explicitly for `completing-read' - it is not even mentioned there. To understand COLLECTION for `completing-read', that node not the best place to go. As was suggested earlier (see above), node `Programmed Completion' is where we should send someone for information about a function-valued COLLECTION argument. It doesn't hurt to send them to both nodes or to only their parent, `Completion'. But it is not clear to me that someone trying to use `completing-read' with a function-valued COLLECTION will understand what is needed just from `Basic Completion'. Especially since the `completing-read' doc string mentions only `all-completions' and `try-completion', not `test-completion' (which is OK): Someone going to `Basic Completion' to find out more about parameter COLLECTION for `completing-read' is likely to miss the description of COLLECTION for `test-completion' or to think that it is not relevant. A priori, there is nothing that necessarily connects the COLLECTION parameter of `completing-read' with the COLLECTION parameters of those 3 more-basic functions, or even that connects those 3 COLLECTION parameters. That is, just giving them the same name is not sufficient to specify that they are the same. Just saying to go see `Basic Completion' for info about COLLECTION etc. _suggests_ that there is a connection, but, again, that doesn't mean that someone will see the relevance of `test-completion' here. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-15 15:01 ` Drew Adams @ 2015-10-15 15:24 ` Dmitry Gutov 2015-10-15 16:47 ` Drew Adams 0 siblings, 1 reply; 24+ messages in thread From: Dmitry Gutov @ 2015-10-15 15:24 UTC (permalink / raw) To: Drew Adams, Ryan C. Thompson, Oleh Krehel; +Cc: 21644 On 10/15/2015 06:01 PM, Drew Adams wrote: > Yes and no, IMO. `Basic Completion' certainly provides > some information about "completion, COLLECTION, and > PREDICATE." But for 3 other functions, not explicitly > for `completing-read' - it is not even mentioned there. What's not mentioned? Basic Completion mentions the three key functions. > As was suggested earlier (see above), node `Programmed > Completion' is where we should send someone for information > about a function-valued COLLECTION argument. Basic Completion references Programmed Completion, twice. On the other hand, Programmed Completion assumes that the collection is a function from the outset. This is not necessarily true in completing-read. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-15 15:24 ` Dmitry Gutov @ 2015-10-15 16:47 ` Drew Adams 2015-10-15 17:03 ` Dmitry Gutov 0 siblings, 1 reply; 24+ messages in thread From: Drew Adams @ 2015-10-15 16:47 UTC (permalink / raw) To: Dmitry Gutov, Ryan C. Thompson, Oleh Krehel; +Cc: 21644 > > Yes and no, IMO. `Basic Completion' certainly provides > > some information about "completion, COLLECTION, and > > PREDICATE." But for 3 other functions, not explicitly > > for `completing-read' - it is not even mentioned there. > > What's not mentioned? Basic Completion mentions the three key functions. Please reread what I wrote. I said that `completing-read' is not mentioned in node `Basic Completion'. And it is not. > > As was suggested earlier (see above), node `Programmed > > Completion' is where we should send someone for information > > about a function-valued COLLECTION argument. > > Basic Completion references Programmed Completion, twice. So what? If the bug is that a user will not know the details for a function-valued COLLECTION argument to `completing-read' then the right place to send a reader for __that information__ is node `Programmed Completion'. That is specifically the purpose of that node. And that is the _only_ place that info is provided. > On the other hand, Programmed Completion assumes that the collection is > a function from the outset. This is not necessarily true in completing-read. No one said that that is true. This bug is about that particular case. The point is that mention of a function-valued COLLECTION in the doc string should get readers to `Programmed Completion'. Read what I said. I did not say that we should send users to `P. C.' for general info about COLLECTION. I said: `Programmed Completion' is where we should send someone for information about a function-valued COLLECTION argument. ^^^^^^^^^^^^^^^ And I said, regarding general info about COLLECTION: It doesn't hurt to send them to both nodes or to only their parent, `Completion'. What is inadequate for the function-valued COLLECTION case, is to send readers __only__ to `Basic Completion'. Especially with no indication that they need to consult not only `all-completions' and `try-completion' there, but also `test-completion'. That's the missing info, if you send them only to `B. C.': no info that `test-completion' is relevant to the function-valued COLLECTION case for `completing-read'. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-15 16:47 ` Drew Adams @ 2015-10-15 17:03 ` Dmitry Gutov 2015-10-15 20:28 ` Drew Adams 0 siblings, 1 reply; 24+ messages in thread From: Dmitry Gutov @ 2015-10-15 17:03 UTC (permalink / raw) To: Drew Adams, Ryan C. Thompson, Oleh Krehel; +Cc: 21644 On 10/15/2015 07:47 PM, Drew Adams wrote: > Please reread what I wrote. I said that `completing-read' is > not mentioned in node `Basic Completion'. And it is not. I see, thanks. But if you want me to read your writings in whole, you should really try to write more concisely. >> Basic Completion references Programmed Completion, twice. > > So what? If if they want to find out about function-value COLLECTION, they'll go there. On the other hand, we say that the node in question has information about completion, collection and predicate. That includes the case when the collection is not a function. > If the bug is that a user will not know the details for a > function-valued COLLECTION argument to `completing-read' then the > right place to send a reader for __that information__ is node > `Programmed Completion'. _This_ bug was about that. That doesn't mean we should fix it by introducing another bug. > And I said, regarding general info about COLLECTION: > > It doesn't hurt to send them to both nodes or to only > their parent, `Completion'. I think that asking the user to read the whole Completion section is too much. Basic Completion already contains the necessary information, or links to it. If the user wants the overview, they can navigate to the parent node just as easily. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-15 17:03 ` Dmitry Gutov @ 2015-10-15 20:28 ` Drew Adams 2015-10-15 21:07 ` Dmitry Gutov 0 siblings, 1 reply; 24+ messages in thread From: Drew Adams @ 2015-10-15 20:28 UTC (permalink / raw) To: Dmitry Gutov, Ryan C. Thompson, Oleh Krehel; +Cc: 21644 > > If the bug is that a user will not know the details for a > > function-valued COLLECTION argument to `completing-read' then the > > right place to send a reader for __that information__ is node > > `Programmed Completion'. > > _This_ bug was about that. That doesn't mean we should fix it by > introducing another bug. No one has said anything that would introduce another bug. It's about fixing this bug, by getting users to the information about function-valued COLLECTION. And that info is in node `Programmed Completion'. No one has said that users should not consult `Basic Completion' for info about `all-completions', `try-completion', and `test-completion'. > > And I said, regarding general info about COLLECTION: > > It doesn't hurt to send them to both nodes or to only > > their parent, `Completion'. > > I think that asking the user to read the whole Completion section is too > much. No one is asking users to read the whole `Completion' section. That is the section that covers all of the info about `completing-read', _if_ you insist on pointing to only one section. If you send them to only one section then a section that talks only about the low-level functions `*-completion[s]' is not the right destination. Again: "It doesn't hurt to send them to both nodes". > Basic Completion already contains the necessary information, No, it does not. It says *nothing* about `completing-read'. Doesn't even mention it. > or links to it. As does `Completion'. Really what should be done is to link from the `completing-read' doc string only to node `Minibuffer Completion', which is the node that documents `completing-read'. But that node should document COLLECTION (it does not), and that doc of COLLECTION should point to node `Programmed Completion' for details about function-valued COLLECTION. It is a bug (IMHO) that the node that documents `completing-read' does not specify parameter COLLECTION - which is arguably the *most important* parameter. Fix that bug and link to node `Minibuffer Completion' from the doc string, and you will have fixed this bug as well. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-15 20:28 ` Drew Adams @ 2015-10-15 21:07 ` Dmitry Gutov 2015-10-16 9:45 ` Eli Zaretskii 2015-10-16 9:46 ` Eli Zaretskii 0 siblings, 2 replies; 24+ messages in thread From: Dmitry Gutov @ 2015-10-15 21:07 UTC (permalink / raw) To: Drew Adams, Ryan C. Thompson, Oleh Krehel; +Cc: 21644 On 10/15/2015 11:28 PM, Drew Adams wrote: > No one has said anything that would introduce another bug. > It's about fixing this bug, by getting users to the information > about function-valued COLLECTION. And that info is in node > `Programmed Completion'. > > No one has said that users should not consult `Basic Completion' > for info about `all-completions', `try-completion', and > `test-completion'. The current sentence that refers to the Info node would become wrong. But I suppose an alternative wording might escape that problem. Patch welcome. > No one is asking users to read the whole `Completion' section. > That is the section that covers all of the info about > `completing-read', _if_ you insist on pointing to only one section. If you link to Completion as a whole, the user might not know better than to read it all. > Really what should be done is to link from the `completing-read' > doc string only to node `Minibuffer Completion', which is the > node that documents `completing-read'. I don't know about that: that page basically re-tells the docstring of completing-read. Sending to it from that docstring seems redundant. > It is a bug (IMHO) that the node that documents `completing-read' > does not specify parameter COLLECTION - which is arguably the > *most important* parameter. You're probably right. Please send a patch. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-15 21:07 ` Dmitry Gutov @ 2015-10-16 9:45 ` Eli Zaretskii 2015-10-16 10:24 ` Dmitry Gutov 2015-10-16 9:46 ` Eli Zaretskii 1 sibling, 1 reply; 24+ messages in thread From: Eli Zaretskii @ 2015-10-16 9:45 UTC (permalink / raw) To: Dmitry Gutov; +Cc: 21644, rct, ohwoeowho > From: Dmitry Gutov <dgutov@yandex.ru> > Date: Fri, 16 Oct 2015 00:07:40 +0300 > Cc: 21644@debbugs.gnu.org > > On 10/15/2015 11:28 PM, Drew Adams wrote: > > > No one has said anything that would introduce another bug. > > It's about fixing this bug, by getting users to the information > > about function-valued COLLECTION. And that info is in node > > `Programmed Completion'. > > > > No one has said that users should not consult `Basic Completion' > > for info about `all-completions', `try-completion', and > > `test-completion'. > > The current sentence that refers to the Info node would become wrong. > But I suppose an alternative wording might escape that problem. > > Patch welcome. Done. > > Really what should be done is to link from the `completing-read' > > doc string only to node `Minibuffer Completion', which is the > > node that documents `completing-read'. > > I don't know about that: that page basically re-tells the docstring of > completing-read. Sending to it from that docstring seems redundant. I agree. > > It is a bug (IMHO) that the node that documents `completing-read' > > does not specify parameter COLLECTION - which is arguably the > > *most important* parameter. > > You're probably right. Please send a patch. Done. I also re-added the references to the completion functions into the doc string of completing-read (and added 2 more functions to that list). While referencing the manual is good, especially for complex topics, I feel that the absolute minimum of usage information, including the arguments with which callbacks can be called, should be available from the doc strings. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-16 9:45 ` Eli Zaretskii @ 2015-10-16 10:24 ` Dmitry Gutov 0 siblings, 0 replies; 24+ messages in thread From: Dmitry Gutov @ 2015-10-16 10:24 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 21644, rct, ohwoeowho On 10/16/2015 12:45 PM, Eli Zaretskii wrote: > I also re-added the references to the completion functions into the > doc string of completing-read (and added 2 more functions to that > list). While referencing the manual is good, especially for complex > topics, I feel that the absolute minimum of usage information, > including the arguments with which callbacks can be called, should be > available from the doc strings. All right. That's a bit too verbose for my taste, but I'm not going to argue. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-15 21:07 ` Dmitry Gutov 2015-10-16 9:45 ` Eli Zaretskii @ 2015-10-16 9:46 ` Eli Zaretskii 2015-10-16 9:54 ` Dmitry Gutov 2015-10-16 13:12 ` Stefan Monnier 1 sibling, 2 replies; 24+ messages in thread From: Eli Zaretskii @ 2015-10-16 9:46 UTC (permalink / raw) To: Dmitry Gutov; +Cc: 21644, rct, ohwoeowho Btw, the completion--unquote argument to COMPLETION is not documented -- is that on purpose? ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-16 9:46 ` Eli Zaretskii @ 2015-10-16 9:54 ` Dmitry Gutov 2015-10-16 13:12 ` Stefan Monnier 1 sibling, 0 replies; 24+ messages in thread From: Dmitry Gutov @ 2015-10-16 9:54 UTC (permalink / raw) To: Eli Zaretskii; +Cc: ohwoeowho, 21644, rct, Stefan Monnier On 10/16/2015 12:46 PM, Eli Zaretskii wrote: > Btw, the completion--unquote argument to COMPLETION is not documented > -- is that on purpose? Cc'ing Stefan. ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-16 9:46 ` Eli Zaretskii 2015-10-16 9:54 ` Dmitry Gutov @ 2015-10-16 13:12 ` Stefan Monnier 2015-10-16 13:44 ` Eli Zaretskii 1 sibling, 1 reply; 24+ messages in thread From: Stefan Monnier @ 2015-10-16 13:12 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Dmitry Gutov, 21644, ohwoeowho, rct > Btw, the completion--unquote argument to COMPLETION is not documented > -- is that on purpose? Yes. It's only used internally by completion-table-with-quoting. [ Admittedly, it's used in other places as well, but only after checking for the presence of the completion--unquote-requote property which is set by completion-table-with-quoting. ] Stefan ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-16 13:12 ` Stefan Monnier @ 2015-10-16 13:44 ` Eli Zaretskii 2015-10-16 14:03 ` Stefan Monnier 0 siblings, 1 reply; 24+ messages in thread From: Eli Zaretskii @ 2015-10-16 13:44 UTC (permalink / raw) To: Stefan Monnier; +Cc: dgutov, 21644, ohwoeowho, rct > From: Stefan Monnier <monnier@iro.umontreal.ca> > Cc: Dmitry Gutov <dgutov@yandex.ru>, 21644@debbugs.gnu.org, rct@thompsonclan.org, drew.adams@oracle.com, ohwoeowho@gmail.com > Date: Fri, 16 Oct 2015 09:12:36 -0400 > > > Btw, the completion--unquote argument to COMPLETION is not documented > > -- is that on purpose? > > Yes. It's only used internally by completion-table-with-quoting. So no user COLLECTION callback will ever be called with it? ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-16 13:44 ` Eli Zaretskii @ 2015-10-16 14:03 ` Stefan Monnier 0 siblings, 0 replies; 24+ messages in thread From: Stefan Monnier @ 2015-10-16 14:03 UTC (permalink / raw) To: Eli Zaretskii; +Cc: dgutov, 21644, ohwoeowho, rct >> > Btw, the completion--unquote argument to COMPLETION is not documented >> > -- is that on purpose? >> Yes. It's only used internally by completion-table-with-quoting. > So no user COLLECTION callback will ever be called with it? That's the intention, yes, Stefan ^ permalink raw reply [flat|nested] 24+ messages in thread
* bug#21644: 24.4; completing-read acts differently on functional collection 2015-10-13 1:34 ` Ryan 2015-10-13 2:27 ` Dmitry Gutov @ 2015-10-16 13:12 ` Stefan Monnier 1 sibling, 0 replies; 24+ messages in thread From: Stefan Monnier @ 2015-10-16 13:12 UTC (permalink / raw) To: Ryan; +Cc: 21644, Oleh Krehel, Dmitry Gutov >> (if (functionp collection) >> collection >> ;; Capture collection in a closure >> (lambda (string pred all) >> (funcall >> (cond >> ((eq all 't) >> #'all-completions) >> ((eq all 'lambda) >> #'test-completion) >> (t >> #'try-completion)) >> string collection pred)))) > I wasn't aware of `test-completion'. I was going based on the docstring for > `completing-read', which only mentions `try-completion' and > `all-completions'. Is there any other documentation I should have consulted? Don't write the code above. Use complete-with-action (or completion-table-dynamic if that fits your need) which should handle all the possible values of `all', including the new ones we'll introduce in Emacs-27. Stefan ^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2015-10-16 15:53 UTC | newest] Thread overview: 24+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <<5615A2EA.4@thompsonclan.org> [not found] ` <<87vbahmzwd.fsf@gmail.com> [not found] ` <<561C5D0B.9070303@yandex.ru> [not found] ` <<561C5FB0.6030105@thompsonclan.org> [not found] ` <<561C6C12.20803@yandex.ru> [not found] ` <<561D54AF.7090701@thompsonclan.org> [not found] ` <<561F35AD.8000803@yandex.ru> [not found] ` <<c92dc5c7-bf93-4040-9da1-96b1a57b560a@default> [not found] ` <<561FC52F.1010606@yandex.ru> [not found] ` <<4fe19dae-4269-401b-82bd-10f9d368a921@default> [not found] ` <<561FDC63.6010609@yandex.ru> [not found] ` <<917e38a9-d74b-4e41-bc7b-90aeee69584c@default> [not found] ` <<5620159C.3060401@yandex.ru> [not found] ` <<837fmn6tb3.fsf@gnu.org> 2015-10-16 15:53 ` bug#21644: 24.4; completing-read acts differently on functional collection Drew Adams 2015-10-07 22:55 Ryan C. Thompson 2015-10-08 10:13 ` Oleh Krehel 2015-10-13 1:23 ` Dmitry Gutov 2015-10-13 1:34 ` Ryan 2015-10-13 2:27 ` Dmitry Gutov 2015-10-13 18:59 ` Ryan C. Thompson 2015-10-15 5:12 ` Dmitry Gutov 2015-10-15 5:17 ` Ryan 2015-10-15 9:18 ` Dmitry Gutov 2015-10-15 15:01 ` Drew Adams 2015-10-15 15:24 ` Dmitry Gutov 2015-10-15 16:47 ` Drew Adams 2015-10-15 17:03 ` Dmitry Gutov 2015-10-15 20:28 ` Drew Adams 2015-10-15 21:07 ` Dmitry Gutov 2015-10-16 9:45 ` Eli Zaretskii 2015-10-16 10:24 ` Dmitry Gutov 2015-10-16 9:46 ` Eli Zaretskii 2015-10-16 9:54 ` Dmitry Gutov 2015-10-16 13:12 ` Stefan Monnier 2015-10-16 13:44 ` Eli Zaretskii 2015-10-16 14:03 ` Stefan Monnier 2015-10-16 13:12 ` Stefan Monnier
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.