Function: completion--sifn-regardless-of-system-users

completion--sifn-regardless-of-system-users is a byte-compiled function defined in minibuffer.el.gz.

Signature

(completion--sifn-regardless-of-system-users FILENAME)

Source Code

;; Defined in /usr/src/emacs/lisp/minibuffer.el.gz
    (file-error nil)))               ;PCM often calls with invalid directories.

(defun completion--sifn-regardless-of-system-users (filename)
  ;; `substitute-in-file-name' handles `~FOO' specially (by cutting
  ;; any prefix to it that ends in `/', so `/foo/~bar/baz' turns into
  ;; `~bar/baz') but only if `FOO' is the name of a user on the system.
  ;; Completion of `~FOO' against the set of user names is handled
  ;; already in `completion-file-name-table' when `~FOO' occurs at the
  ;; beginning of the file name, but if we want to support such completions
  ;; "in the middle", I see two ways to do it:
  ;; - Do something similar to `completion--embedded-envvar-table'.
  ;; - Extend `substitute-in-file-name's handling of `~FOO' so
  ;;   `/foo/~bar/baz' turns into `~bar/baz' regardless if `bar'
  ;;   is a valid user name (because we hope that it will be completed
  ;;   to a user name).
  ;; The second option is what we do here.  (bug#32215)
  ;; FIXME: This breaks completion when you have a file or directory
  ;; whose name starts with `~'.
  ;; FIXME: This doesn't take file-name-handlers into account.
  (while (string-match "/~[[:alnum:]_*-]" filename)
    (setq filename (substring filename (1+ (match-beginning 0)))))
  (substitute-in-file-name filename))