unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#51130: 29.0.50; shell completion fails to complete filenames
@ 2021-10-11  3:08 Carlos Pita
  2022-09-12 11:22 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Carlos Pita @ 2021-10-11  3:08 UTC (permalink / raw)
  To: 51130

Hi,

I've asked about this in gmane.emacs.help but then realized that it
might be a bug.

In shell-mode there are a number of c-a-p functions registered:

   comint-c-a-p-replace-by-expanded-history
   shell-environment-variable-completion
   shell-command-completion
   shell-c-a-p-replace-by-expanded-directory
   pcomplete-completions-at-point
   shell-filename-completion
   comint-filename-completion

Most of the time it is pcomplete-completions-at-point the one which
returns the completion candidates, and this works great as long as the
there is a pcomplete/xxx function registered for the command xxx.

Now, many usual commands like cp don't have a pcomplete handler so they
behave very poorly regarding completion, take for example:

     cp <TAB>

this doesn't give me any completion candidate! If I instead do:

     cp ./<TAB>

I then get filename completions (although not from pcomplete). I find
this behavior very inconvenient since often commands take filenames as
arguments and I would prefer filename completion to be triggered by
default for commands not known by pcomplete.

Doing some debugging reveals that this might be a bug.

In shell.el we have:

  ;; Don't use pcomplete's defaulting mechanism, rely on
  ;; shell-dynamic-complete-functions instead.
  (setq-local pcomplete-default-completion-function #'ignore)

So pcomplete is falling back to the ignore (no-op) function. If you
kill the local binding in the shell buffer, then the default of the
default does complete paths.

And what are those dynamic complete functions that are favored in lieu of
pcomplete's default? I don't know, but next in the completion sequence
we have:

	(defun comint-filename-completion ()
      "Return completion data for filename at point, if any."
      (when (comint--match-partial-filename)
        (comint--complete-file-name-data)))

Here (comint--match-partial-filename) will never be true so, ultimately,
we get no completion at all.

Anyone knows what might be the reason to set
pcomplete-default-completion-function to #'ignore when the next
functions in the sequence are unable to do a better job?

Best regards,
Carlos

---

In GNU Emacs 29.0.50 (build 1, x86_64-apple-darwin20.6.0, NS appkit-2022.60 Version 11.6 (Build 20G165))
 of 2021-10-07 built on Carloss-MacBook-Pro.local
Repository revision: d2611920685ca415a1d85ffb9567b968518028d6
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2022
System Description:  macOS 11.6

Configured using:
 'configure --without-native-compilation'

Configured features:
ACL DBUS GLIB GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY KQUEUE
NS PDUMPER PNG RSVG THREADS TIFF TOOLKIT_SCROLL_BARS XIM ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Article

Minor modes in effect:
  recentf-mode: t
  shell-dirtrack-mode: t
  treemacs-icons-dired-mode: t
  treemacs-filewatch-mode: t
  treemacs-follow-mode: t
  treemacs-git-mode: t
  treemacs-fringe-indicator-mode: t
  ivy-mode: t
  company-box-mode: t
  winner-mode: t
  global-flycheck-mode: t
  global-company-mode: t
  company-mode: t
  which-key-mode: t
  override-global-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  electric-pair-mode: t
  minions-mode: t
  doom-modeline-mode: t
  ns-auto-titlebar-mode: t
  straight-use-package-mode: t
  straight-package-neutering-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-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
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/Users/carlos/.emacs.d/straight/build/transient/transient hides /Applications/Emacs.app/Contents/Resources/lisp/transient
/Users/carlos/.emacs.d/straight/build/org/ob-exp hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-exp
/Users/carlos/.emacs.d/straight/build/org/ob-emacs-lisp hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-emacs-lisp
/Users/carlos/.emacs.d/straight/build/org/oc hides /Applications/Emacs.app/Contents/Resources/lisp/org/oc
/Users/carlos/.emacs.d/straight/build/org/ob-css hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-css
/Users/carlos/.emacs.d/straight/build/org/ob-lob hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-lob
/Users/carlos/.emacs.d/straight/build/org/ol-irc hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-irc
/Users/carlos/.emacs.d/straight/build/org/ob-forth hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-forth
/Users/carlos/.emacs.d/straight/build/org/org-macs hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-macs
/Users/carlos/.emacs.d/straight/build/org/ob hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob
/Users/carlos/.emacs.d/straight/build/org/org-version hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-version
/Users/carlos/.emacs.d/straight/build/org/ob-scheme hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-scheme
/Users/carlos/.emacs.d/straight/build/org/ox hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox
/Users/carlos/.emacs.d/straight/build/org/ob-C hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-C
/Users/carlos/.emacs.d/straight/build/org/org-capture hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-capture
/Users/carlos/.emacs.d/straight/build/org/ob-ref hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-ref
/Users/carlos/.emacs.d/straight/build/org/ob-clojure hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-clojure
/Users/carlos/.emacs.d/straight/build/org/org-mouse hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-mouse
/Users/carlos/.emacs.d/straight/build/org/org-ctags hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-ctags
/Users/carlos/.emacs.d/straight/build/org/org-entities hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-entities
/Users/carlos/.emacs.d/straight/build/org/org-archive hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-archive
/Users/carlos/.emacs.d/straight/build/org/ob-screen hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-screen
/Users/carlos/.emacs.d/straight/build/org/ol-bibtex hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-bibtex
/Users/carlos/.emacs.d/straight/build/org/ob-haskell hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-haskell
/Users/carlos/.emacs.d/straight/build/org/org-table hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-table
/Users/carlos/.emacs.d/straight/build/org/ol-eww hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-eww
/Users/carlos/.emacs.d/straight/build/org/ox-org hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-org
/Users/carlos/.emacs.d/straight/build/org/org-num hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-num
/Users/carlos/.emacs.d/straight/build/org/org-plot hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-plot
/Users/carlos/.emacs.d/straight/build/org/ol-rmail hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-rmail
/Users/carlos/.emacs.d/straight/build/org/ob-awk hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-awk
/Users/carlos/.emacs.d/straight/build/org/ob-groovy hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-groovy
/Users/carlos/.emacs.d/straight/build/org/ob-octave hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-octave
/Users/carlos/.emacs.d/straight/build/org/org-faces hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-faces
/Users/carlos/.emacs.d/straight/build/org/oc-biblatex hides /Applications/Emacs.app/Contents/Resources/lisp/org/oc-biblatex
/Users/carlos/.emacs.d/straight/build/org/org-colview hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-colview
/Users/carlos/.emacs.d/straight/build/org/ob-R hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-R
/Users/carlos/.emacs.d/straight/build/org/org-refile hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-refile
/Users/carlos/.emacs.d/straight/build/org/org-timer hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-timer
/Users/carlos/.emacs.d/straight/build/org/org-mobile hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-mobile
/Users/carlos/.emacs.d/straight/build/org/ob-fortran hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-fortran
/Users/carlos/.emacs.d/straight/build/org/ob-shell hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-shell
/Users/carlos/.emacs.d/straight/build/org/ob-perl hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-perl
/Users/carlos/.emacs.d/straight/build/org/ob-sqlite hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-sqlite
/Users/carlos/.emacs.d/straight/build/org/oc-basic hides /Applications/Emacs.app/Contents/Resources/lisp/org/oc-basic
/Users/carlos/.emacs.d/straight/build/org/ob-sed hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-sed
/Users/carlos/.emacs.d/straight/build/org/org-list hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-list
/Users/carlos/.emacs.d/straight/build/org/ob-ruby hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-ruby
/Users/carlos/.emacs.d/straight/build/org/ob-eval hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-eval
/Users/carlos/.emacs.d/straight/build/org/org-habit hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-habit
/Users/carlos/.emacs.d/straight/build/org/org-clock hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-clock
/Users/carlos/.emacs.d/straight/build/org/org-goto hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-goto
/Users/carlos/.emacs.d/straight/build/org/ox-html hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-html
/Users/carlos/.emacs.d/straight/build/org/org-src hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-src
/Users/carlos/.emacs.d/straight/build/org/ob-lisp hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-lisp
/Users/carlos/.emacs.d/straight/build/org/ol-eshell hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-eshell
/Users/carlos/.emacs.d/straight/build/org/ob-ditaa hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-ditaa
/Users/carlos/.emacs.d/straight/build/org/org-pcomplete hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-pcomplete
/Users/carlos/.emacs.d/straight/build/org/org-lint hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-lint
/Users/carlos/.emacs.d/straight/build/org/ox-latex hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-latex
/Users/carlos/.emacs.d/straight/build/org/ob-sass hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-sass
/Users/carlos/.emacs.d/straight/build/org/ob-tangle hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-tangle
/Users/carlos/.emacs.d/straight/build/org/ob-calc hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-calc
/Users/carlos/.emacs.d/straight/build/org/ob-java hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-java
/Users/carlos/.emacs.d/straight/build/org/ox-icalendar hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-icalendar
/Users/carlos/.emacs.d/straight/build/org/ol-mhe hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-mhe
/Users/carlos/.emacs.d/straight/build/org/org-attach-git hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-attach-git
/Users/carlos/.emacs.d/straight/build/org/ox-md hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-md
/Users/carlos/.emacs.d/straight/build/org/ox-beamer hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-beamer
/Users/carlos/.emacs.d/straight/build/org/org-element hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-element
/Users/carlos/.emacs.d/straight/build/org/oc-natbib hides /Applications/Emacs.app/Contents/Resources/lisp/org/oc-natbib
/Users/carlos/.emacs.d/straight/build/org/org-protocol hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-protocol
/Users/carlos/.emacs.d/straight/build/org/ob-gnuplot hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-gnuplot
/Users/carlos/.emacs.d/straight/build/org/org-tempo hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-tempo
/Users/carlos/.emacs.d/straight/build/org/ob-latex hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-latex
/Users/carlos/.emacs.d/straight/build/org/ol-w3m hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-w3m
/Users/carlos/.emacs.d/straight/build/org/org-id hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-id
/Users/carlos/.emacs.d/straight/build/org/ox-man hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-man
/Users/carlos/.emacs.d/straight/build/org/ol-doi hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-doi
/Users/carlos/.emacs.d/straight/build/org/org-feed hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-feed
/Users/carlos/.emacs.d/straight/build/org/ob-julia hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-julia
/Users/carlos/.emacs.d/straight/build/org/ob-lua hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-lua
/Users/carlos/.emacs.d/straight/build/org/ob-table hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-table
/Users/carlos/.emacs.d/straight/build/org/ob-ocaml hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-ocaml
/Users/carlos/.emacs.d/straight/build/org/oc-csl hides /Applications/Emacs.app/Contents/Resources/lisp/org/oc-csl
/Users/carlos/.emacs.d/straight/build/org/ol-gnus hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-gnus
/Users/carlos/.emacs.d/straight/build/org/org-indent hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-indent
/Users/carlos/.emacs.d/straight/build/org/ob-lilypond hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-lilypond
/Users/carlos/.emacs.d/straight/build/org/ob-matlab hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-matlab
/Users/carlos/.emacs.d/straight/build/org/org-datetree hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-datetree
/Users/carlos/.emacs.d/straight/build/org/ol-docview hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-docview
/Users/carlos/.emacs.d/straight/build/org/ob-python hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-python
/Users/carlos/.emacs.d/straight/build/org/ob-makefile hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-makefile
/Users/carlos/.emacs.d/straight/build/org/org-duration hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-duration
/Users/carlos/.emacs.d/straight/build/org/org-agenda hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-agenda
/Users/carlos/.emacs.d/straight/build/org/ob-dot hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-dot
/Users/carlos/.emacs.d/straight/build/org/ob-js hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-js
/Users/carlos/.emacs.d/straight/build/org/ox-publish hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-publish
/Users/carlos/.emacs.d/straight/build/org/org-inlinetask hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-inlinetask
/Users/carlos/.emacs.d/straight/build/org/ob-org hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-org
/Users/carlos/.emacs.d/straight/build/org/org-keys hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-keys
/Users/carlos/.emacs.d/straight/build/org/ob-core hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-core
/Users/carlos/.emacs.d/straight/build/org/org-compat hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-compat
/Users/carlos/.emacs.d/straight/build/org/ol hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol
/Users/carlos/.emacs.d/straight/build/org/ox-odt hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-odt
/Users/carlos/.emacs.d/straight/build/org/ol-info hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-info
/Users/carlos/.emacs.d/straight/build/org/ob-plantuml hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-plantuml
/Users/carlos/.emacs.d/straight/build/org/ob-eshell hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-eshell
/Users/carlos/.emacs.d/straight/build/org/ox-ascii hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-ascii
/Users/carlos/.emacs.d/straight/build/org/org-loaddefs hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-loaddefs
/Users/carlos/.emacs.d/straight/build/org/ox-koma-letter hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-koma-letter
/Users/carlos/.emacs.d/straight/build/org/ob-maxima hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-maxima
/Users/carlos/.emacs.d/straight/build/org/org hides /Applications/Emacs.app/Contents/Resources/lisp/org/org
/Users/carlos/.emacs.d/straight/build/org/ol-bbdb hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-bbdb
/Users/carlos/.emacs.d/straight/build/org/org-macro hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-macro
/Users/carlos/.emacs.d/straight/build/org/ob-sql hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-sql
/Users/carlos/.emacs.d/straight/build/org/org-attach hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-attach
/Users/carlos/.emacs.d/straight/build/org/ob-processing hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-processing
/Users/carlos/.emacs.d/straight/build/org/ox-texinfo hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-texinfo
/Users/carlos/.emacs.d/straight/build/org/org-crypt hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-crypt
/Users/carlos/.emacs.d/straight/build/org/org-footnote hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-footnote
/Users/carlos/.emacs.d/straight/build/org/org-install hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-install
/Users/carlos/.emacs.d/straight/build/org/ob-comint hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-comint
/Users/carlos/.emacs.d/straight/build/let-alist/let-alist hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/let-alist

Features:
(shadow emacsbug sendmail canlock flyspell ispell nndoc sort smiley
gnus-cite mail-extr gnus-async gnus-bcklg gnus-draft gnus-ml disp-table
nndraft nnmh nnfolder utf-7 epa-file gnutls network-stream nsm
gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art
mm-uu mml2015 mm-view mml-smime smime dig nntp gnus-cache gnus-sum shr
kinsoku svg dom browse-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util url-parse
url-vars mailcap gnus-group gnus-undo gnus-start gnus-dbus dbus xml
gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo parse-time iso8601
gnus-spec gnus-int gnus-range message rmc puny rfc822 mml mml-sec epa
derived epg rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader gnus-win gnus nnheader gnus-util
rmail rmail-loaddefs auth-source password-cache rfc2047 rfc2045
ietf-drums mail-utils mm-util mail-prsvr cus-edit cus-start cus-load
cl-print pcmpl-unix recentf tree-widget wid-edit treemacs-bookmarks
bookmark pp edebug backtrace vc-mtn vc-hg vc-git diff-mode vc-bzr vc-src
vc-sccs vc-svn vc-cvs vc-rcs vc vc-dispatcher jka-compr time-date
eieio-opt speedbar ezimage dframe shortdoc help-fns radix-tree shell
pcomplete thingatpt ivy-hydra hydra lv counsel xdg dired-x
treemacs-icons-dired treemacs-all-the-icons treemacs
treemacs-header-line treemacs-compatibility treemacs-mode
treemacs-interface treemacs-extensions treemacs-mouse-interface
treemacs-tags imenu treemacs-persistence treemacs-filewatch-mode
filenotify treemacs-follow-mode treemacs-rendering treemacs-async
treemacs-workspaces treemacs-dom treemacs-visuals
treemacs-fringe-indicator treemacs-scope eieio eieio-core eieio-loaddefs
pulse treemacs-faces treemacs-icons treemacs-themes treemacs-core-utils
pfuture inline hl-line ht treemacs-logging treemacs-customization
treemacs-macros dired dired-loaddefs compile text-property-search comint
swiper ivy delsel ivy-faces ivy-overlay colir color company-box
company-box-doc frame-local company-box-icons display-line-numbers
noutline outline server pdf-tools-autoloads tablist-autoloads winner
org-roam-autoloads emacsql-sqlite-autoloads emacsql-autoloads
lsp-pyright-autoloads pyvenv eshell esh-cmd esh-ext esh-opt esh-proc
esh-io esh-arg esh-module esh-groups esh-util pyvenv-autoloads
exec-path-from-shell exec-path-from-shell-autoloads hl-todo-autoloads
flycheck ansi-color json map find-func flycheck-autoloads
let-alist-autoloads pkg-info-autoloads epl-autoloads dap-mode-autoloads
bui-autoloads lsp-treemacs-autoloads lsp-ivy-autoloads lsp-ui-autoloads
lsp-mode-autoloads markdown-mode-autoloads spinner-autoloads
treemacs-all-the-icons-autoloads treemacs-icons-dired-autoloads
treemacs-persp-autoloads persp-mode-autoloads treemacs-magit-autoloads
magit-autoloads magit-section-autoloads git-commit-autoloads
with-editor-autoloads transient-autoloads treemacs-projectile-autoloads
treemacs-autoloads cfrs-autoloads posframe-autoloads ht-autoloads
pfuture-autoloads ace-window-autoloads projectile-autoloads
ivy-hydra-autoloads hydra-autoloads lv-autoloads counsel-autoloads
swiper-autoloads ivy-autoloads company-box-autoloads
frame-local-autoloads company-oddmuse company-keywords company-etags
etags fileloop generator xref project ring company-gtags
company-dabbrev-code company-dabbrev company-files company-clang
company-capf company-cmake company-semantic company-template
company-bbdb company pcase company-autoloads which-key advice
which-key-autoloads visual-fill-column visual-fill-column-autoloads
wgrep-autoloads edmacro kmacro avy-autoloads use-package-bind-key
bind-key easy-mmode undo-tree diff undo-tree-autoloads elec-pair minions
minions-autoloads doom-modeline doom-modeline-segments doom-modeline-env
doom-modeline-core shrink-path rx f s all-the-icons all-the-icons-faces
data-material data-weathericons data-octicons data-fileicons
data-faicons data-alltheicons dash doom-modeline-autoloads
shrink-path-autoloads f-autoloads dash-autoloads s-autoloads
all-the-icons-autoloads doom-themes-ext-org doom-themes-ext-treemacs
doom-themes-ext-visual-bell face-remap doom-solarized-light-theme
doom-themes doom-themes-base doom-themes-autoloads finder-inf
ns-auto-titlebar ns-auto-titlebar-autoloads use-package-core
use-package-autoloads bind-key-autoloads straight-autoloads info cl-seq
cl-extra help-mode seq byte-opt straight subr-x cl-macs gv cl-loaddefs
cl-lib bytecomp byte-compile cconv iso-transl tooltip eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
kqueue cocoa ns lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 455037 48688)
 (symbols 48 32723 3)
 (strings 32 113488 5335)
 (string-bytes 1 3951202)
 (vectors 16 58019)
 (vector-slots 8 775007 32747)
 (floats 8 2271 1187)
 (intervals 56 6864 2248)
 (buffers 992 37))





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#51130: 29.0.50; shell completion fails to complete filenames
  2021-10-11  3:08 bug#51130: 29.0.50; shell completion fails to complete filenames Carlos Pita
@ 2022-09-12 11:22 ` Lars Ingebrigtsen
  2022-09-12 14:33   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-12 11:22 UTC (permalink / raw)
  To: Carlos Pita; +Cc: 51130, Stefan Monnier

Carlos Pita <carlosjosepita2@gmail.com> writes:

> Now, many usual commands like cp don't have a pcomplete handler so they
> behave very poorly regarding completion, take for example:
>
>      cp <TAB>
>
> this doesn't give me any completion candidate!

[...]

> In shell.el we have:
>
>   ;; Don't use pcomplete's defaulting mechanism, rely on
>   ;; shell-dynamic-complete-functions instead.
>   (setq-local pcomplete-default-completion-function #'ignore)
>
> So pcomplete is falling back to the ignore (no-op) function. If you
> kill the local binding in the shell buffer, then the default of the
> default does complete paths.

This was possibly added by:

commit e17d9003618cef75852a0b88334cea66a5c4b016
Author:     Stefan Monnier <monnier@iro.umontreal.ca>
AuthorDate: Sat Jun 4 09:31:34 2011 -0300

    * lisp/shell.el: Require and use pcomplete.
    (shell-dynamic-complete-functions): Add pcomplete-completions-at-point.
    (shell-completion-vars): Set pcomplete-default-completion-function.

Just leaving pcomplete-default-completion-function alone seems to give
better results in shell-mode (after testing very briefly), so I'm not
sure why that was added.

Perhaps Stefan has some comments; added to the CCs.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#51130: 29.0.50; shell completion fails to complete filenames
  2022-09-12 11:22 ` Lars Ingebrigtsen
@ 2022-09-12 14:33   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-09-13 11:19     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-09-12 14:33 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 51130, Carlos Pita

> commit e17d9003618cef75852a0b88334cea66a5c4b016
> Author:     Stefan Monnier <monnier@iro.umontreal.ca>
> AuthorDate: Sat Jun 4 09:31:34 2011 -0300
>
>     * lisp/shell.el: Require and use pcomplete.
>     (shell-dynamic-complete-functions): Add pcomplete-completions-at-point.
>     (shell-completion-vars): Set pcomplete-default-completion-function.
>
> Just leaving pcomplete-default-completion-function alone seems to give
> better results in shell-mode (after testing very briefly), so I'm not
> sure why that was added.

It was added because leaving `pcomplete-default-completion-function`
alone means that the functions after `pcomplete-completions-at-point` in
`shell-dynamic-complete-functions` are not used any more.

Maybe that's indeed what we want.

I don't use `shell` enough to make such a decision.
[ And I don't understand why there's both `shell-filename-completion`
  and `comint-filename-completion` in there either, which makes it even
  more clear to me that I don't know what such changes imply.  ]


        Stefan






^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#51130: 29.0.50; shell completion fails to complete filenames
  2022-09-12 14:33   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-09-13 11:19     ` Lars Ingebrigtsen
  2022-09-13 13:32       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-13 11:19 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 51130, Carlos Pita

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>     * lisp/shell.el: Require and use pcomplete.
>>     (shell-dynamic-complete-functions): Add pcomplete-completions-at-point.
>>     (shell-completion-vars): Set pcomplete-default-completion-function.
>>
>> Just leaving pcomplete-default-completion-function alone seems to give
>> better results in shell-mode (after testing very briefly), so I'm not
>> sure why that was added.
>
> It was added because leaving `pcomplete-default-completion-function`
> alone means that the functions after `pcomplete-completions-at-point` in
> `shell-dynamic-complete-functions` are not used any more.

Uhm...  I don't follow the logic at all.
pcomplete-default-completion-function is documented to be applied if
everything else has failed to do completion, isn't it?





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#51130: 29.0.50; shell completion fails to complete filenames
  2022-09-13 11:19     ` Lars Ingebrigtsen
@ 2022-09-13 13:32       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-09-14 12:28         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-09-13 13:32 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 51130, Carlos Pita

Lars Ingebrigtsen [2022-09-13 13:19:07] wrote:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>>>     * lisp/shell.el: Require and use pcomplete.
>>>     (shell-dynamic-complete-functions): Add pcomplete-completions-at-point.
>>>     (shell-completion-vars): Set pcomplete-default-completion-function.
>>>
>>> Just leaving pcomplete-default-completion-function alone seems to give
>>> better results in shell-mode (after testing very briefly), so I'm not
>>> sure why that was added.
>>
>> It was added because leaving `pcomplete-default-completion-function`
>> alone means that the functions after `pcomplete-completions-at-point` in
>> `shell-dynamic-complete-functions` are not used any more.
>
> Uhm...  I don't follow the logic at all.
> pcomplete-default-completion-function is documented to be applied if
> everything else has failed to do completion, isn't it?

Look at `shell-dynamic-complete-functions`:

    (defcustom shell-dynamic-complete-functions
      '(comint-c-a-p-replace-by-expanded-history
        shell-environment-variable-completion
        shell-command-completion
        shell-c-a-p-replace-by-expanded-directory
        pcomplete-completions-at-point
        shell-filename-completion
        comint-filename-completion)
      "List of functions called to perform completion.
    This variable is used to initialize `comint-dynamic-complete-functions' in the
    shell buffer."
      :type '(repeat function)
      :group 'shell)

if `pcomplete-default-completion-function` is left at its default value,
then `pcomplete-completions-at-point` will never return nil, so the
functions that appear after it in the above list will just never
be used.

The change I introduced tried to preserve as much of the existing
completion as possible, by only using the non-fallback pcomplete rules
and keeping the existing `shell-filename-completion` and
`comint-filename-completion` thingies as the fallback.

I don't know that it's the best choice.  It was just the
conservative choice.


        Stefan






^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#51130: 29.0.50; shell completion fails to complete filenames
  2022-09-13 13:32       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-09-14 12:28         ` Lars Ingebrigtsen
  2022-09-14 14:27           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-14 12:28 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 51130, Carlos Pita

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Look at `shell-dynamic-complete-functions`:
>
>     (defcustom shell-dynamic-complete-functions
>       '(comint-c-a-p-replace-by-expanded-history
>         shell-environment-variable-completion
>         shell-command-completion
>         shell-c-a-p-replace-by-expanded-directory
>         pcomplete-completions-at-point
>         shell-filename-completion
>         comint-filename-completion)
>       "List of functions called to perform completion.
>     This variable is used to initialize `comint-dynamic-complete-functions' in the
>     shell buffer."
>       :type '(repeat function)
>       :group 'shell)
>
> if `pcomplete-default-completion-function` is left at its default value,
> then `pcomplete-completions-at-point` will never return nil, so the
> functions that appear after it in the above list will just never
> be used.

Ah, the detail I missed was that pcomplete-completions-at-point is
(partially) controlled by pcomplete-default-completion-function -- from
the documentation, I assumed that pcomplete-default-completion-function
was run after all of the other completion functions had finished.

> The change I introduced tried to preserve as much of the existing
> completion as possible, by only using the non-fallback pcomplete rules
> and keeping the existing `shell-filename-completion` and
> `comint-filename-completion` thingies as the fallback.
>
> I don't know that it's the best choice.  It was just the
> conservative choice.

Could just put an additional function at the end of the list there that
does what pcomplete-completions-at-point does when
pcomplete-default-completion-function isn't set to #'ignore?





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#51130: 29.0.50; shell completion fails to complete filenames
  2022-09-14 12:28         ` Lars Ingebrigtsen
@ 2022-09-14 14:27           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-09-14 15:20             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-09-14 14:27 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 51130, Carlos Pita

>> The change I introduced tried to preserve as much of the existing
>> completion as possible, by only using the non-fallback pcomplete
>> rules and keeping the existing `shell-filename-completion` and
>> `comint-filename-completion` thingies as the fallback.
>>
>> I don't know that it's the best choice.  It was just the
>> conservative choice.
>
> Could just put an additional function at the end of the list there
> that does what pcomplete-completions-at-point does when
> pcomplete-default-completion-function isn't set to #'ignore?

Could be.  Tho it feels like adding yet another hack upon more hacks
just because we don't know what the other code does.
[ Which is exactly what I did as well when I set
  `pcomplete-default-completion-function` to `ignore`.  ]

I wish someone could take the time to try and understand what
`shell-filename-completion` and `comint-filename-completion` do there
really (I mean, I understand what they're supposed to do, but I don't
understand why they're both there), how they compare to what
`pcomplete-default-completion-function` does by default (which should be
very similar), and then fix bug#51130 The Right Way.


        Stefan






^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#51130: 29.0.50; shell completion fails to complete filenames
  2022-09-14 14:27           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-09-14 15:20             ` Lars Ingebrigtsen
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-14 15:20 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 51130, Carlos Pita

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> I wish someone could take the time to try and understand what
> `shell-filename-completion` and `comint-filename-completion` do there
> really (I mean, I understand what they're supposed to do, but I don't
> understand why they're both there), how they compare to what
> `pcomplete-default-completion-function` does by default (which should be
> very similar), and then fix bug#51130 The Right Way.

It would indeed be nice if somebody did that.  *whistles*





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-09-14 15:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-11  3:08 bug#51130: 29.0.50; shell completion fails to complete filenames Carlos Pita
2022-09-12 11:22 ` Lars Ingebrigtsen
2022-09-12 14:33   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-13 11:19     ` Lars Ingebrigtsen
2022-09-13 13:32       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-14 12:28         ` Lars Ingebrigtsen
2022-09-14 14:27           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-14 15:20             ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).