diff options
Diffstat (limited to 'lisp/pcmpl-linux.el')
-rw-r--r-- | lisp/pcmpl-linux.el | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/pcmpl-linux.el b/lisp/pcmpl-linux.el index 6e036434ef2..df9d24507a0 100644 --- a/lisp/pcmpl-linux.el +++ b/lisp/pcmpl-linux.el @@ -1,4 +1,4 @@ -;;; pcmpl-linux.el --- functions for dealing with GNU/Linux completions +;;; pcmpl-linux.el --- functions for dealing with GNU/Linux completions -*- lexical-binding: t -*- ;; Copyright (C) 1999-2020 Free Software Foundation, Inc. @@ -65,18 +65,22 @@ (pcomplete-opt "hVanfFrsvwt(pcmpl-linux-fs-types)o?L?U?") (while (pcomplete-here (pcomplete-entries) nil 'identity))) +(defconst pcmpl-linux-fs-modules-path-format "/lib/modules/%s/kernel/fs/") + (defun pcmpl-linux-fs-types () "Return a list of available fs modules on GNU/Linux systems." (let ((kernel-ver (pcomplete-process-result "uname" "-r"))) (directory-files - (concat "/lib/modules/" kernel-ver "/kernel/fs/")))) + (format pcmpl-linux-fs-modules-path-format kernel-ver)))) + +(defconst pcmpl-linux-mtab-file "/etc/mtab") (defun pcmpl-linux-mounted-directories () "Return a list of mounted directory names." (let (points) - (when (file-readable-p "/etc/mtab") + (when (file-readable-p pcmpl-linux-mtab-file) (with-temp-buffer - (insert-file-contents-literally "/etc/mtab") + (insert-file-contents-literally pcmpl-linux-mtab-file) (while (not (eobp)) (let* ((line (buffer-substring (point) (line-end-position))) (args (split-string line " "))) |