comparison lisp/comint.el @ 3386:bc4729d67e6e

(comint-filter): Put window-start before the input.
author Richard M. Stallman <rms@gnu.org>
date Tue, 01 Jun 1993 05:31:15 +0000
parents 598d05b3eb3b
children 507f64624555
comparison
equal deleted inserted replaced
3385:1ea5ec97ae18 3386:bc4729d67e6e
138 138
139 (defvar comint-input-ring-size 30 139 (defvar comint-input-ring-size 30
140 "Size of input history ring.") 140 "Size of input history ring.")
141 141
142 (defvar comint-process-echoes nil 142 (defvar comint-process-echoes nil
143 "*If non-`nil', assume that the subprocess echoes any input. 143 "*If non-nil, assume that the subprocess echoes any input.
144 If so, delete one copy of the input so that only one copy eventually 144 If so, delete one copy of the input so that only one copy eventually
145 appears in the buffer. 145 appears in the buffer.
146 146
147 This variable is buffer-local.") 147 This variable is buffer-local.")
148 148
149 ;;; Here are the per-interpreter hooks. 149 ;;; Here are the per-interpreter hooks.
150 (defvar comint-get-old-input (function comint-get-old-input-default) 150 (defvar comint-get-old-input (function comint-get-old-input-default)
151 "Function that submits old text in comint mode. 151 "Function that submits old text in comint mode.
152 This function is called when return is typed while the point is in old text. 152 This function is called when return is typed while the point is in old text.
153 It returns the text to be submitted as process input. The default is 153 It returns the text to be submitted as process input. The default is
154 comint-get-old-input-default, which grabs the current line, and strips off 154 `comint-get-old-input-default', which grabs the current line, and strips off
155 leading text matching comint-prompt-regexp") 155 leading text matching `comint-prompt-regexp'.")
156 156
157 (defvar comint-input-sentinel (function ignore) 157 (defvar comint-input-sentinel (function ignore)
158 "Called on each input submitted to comint mode process by comint-send-input. 158 "Called on each input submitted to comint mode process by `comint-send-input'.
159 Thus it can, for instance, track cd/pushd/popd commands issued to the csh.") 159 Thus it can, for instance, track cd/pushd/popd commands issued to the csh.")
160 160
161 (defvar comint-input-filter 161 (defvar comint-input-filter
162 (function (lambda (str) (not (string-match "\\`\\s *\\'" str)))) 162 (function (lambda (str) (not (string-match "\\`\\s *\\'" str))))
163 "Predicate for filtering additions to input history. 163 "Predicate for filtering additions to input history.
164 Only inputs answering true to this function are saved on the input 164 Only inputs answering true to this function are saved on the input
165 history list. Default is to save anything that isn't all whitespace") 165 history list. Default is to save anything that isn't all whitespace")
166 166
167 (defvar comint-input-sender (function comint-simple-send) 167 (defvar comint-input-sender (function comint-simple-send)
168 "Function to actually send to PROCESS the STRING submitted by user. 168 "Function to actually send to PROCESS the STRING submitted by user.
169 Usually this is just 'comint-simple-send, but if your mode needs to 169 Usually this is just `comint-simple-send', but if your mode needs to
170 massage the input string, this is your hook. This is called from 170 massage the input string, put a different function here.
171 the user command comint-send-input. comint-simple-send just sends 171 `comint-simple-send' just sends the string plus a newline.
172 the string plus a newline.") 172 This is called from the user command `comint-send-input'.")
173 173
174 (defvar comint-eol-on-send 'T 174 (defvar comint-eol-on-send t
175 "If non-nil, then jump to the end of the line before sending input to process. 175 "*Non-nil means go to the end of the line before sending input to process.
176 See comint-send-input") 176 See `comint-send-input'.")
177 177
178 (defvar comint-mode-hook '() 178 (defvar comint-mode-hook '()
179 "Called upon entry into comint-mode 179 "Called upon entry into comint-mode
180 This is run before the process is cranked up.") 180 This is run before the process is cranked up.")
181 181
182 (defvar comint-exec-hook '() 182 (defvar comint-exec-hook '()
183 "Called each time a process is exec'd by comint-exec. 183 "Called each time a process is exec'd by `comint-exec'.
184 This is called after the process is cranked up. It is useful for things that 184 This is called after the process is cranked up. It is useful for things that
185 must be done each time a process is executed in a comint-mode buffer (e.g., 185 must be done each time a process is executed in a comint mode buffer (e.g.,
186 (process-kill-without-query)). In contrast, the comint-mode-hook is only 186 `(process-kill-without-query)'). In contrast, the `comint-mode-hook' is only
187 executed once when the buffer is created.") 187 executed once when the buffer is created.")
188 188
189 (defvar comint-mode-map nil) 189 (defvar comint-mode-map nil)
190 190
191 (defvar comint-ptyp t 191 (defvar comint-ptyp t
192 "True if communications via pty; false if by pipe. Buffer local. 192 "True if communications via pty; false if by pipe. Buffer local.
193 This is to work around a bug in emacs process signalling.") 193 This is to work around a bug in Emacs process signalling.")
194 194
195 ;;(defvar comint-last-input-match "" 195 ;;(defvar comint-last-input-match ""
196 ;; "Last string searched for by comint input history search, for defaulting. 196 ;; "Last string searched for by comint input history search, for defaulting.
197 ;;Buffer local variable.") 197 ;;Buffer local variable.")
198 198
206 (defun comint-mode () 206 (defun comint-mode ()
207 "Major mode for interacting with an inferior interpreter. 207 "Major mode for interacting with an inferior interpreter.
208 Interpreter name is same as buffer name, sans the asterisks. 208 Interpreter name is same as buffer name, sans the asterisks.
209 Return at end of buffer sends line as input. 209 Return at end of buffer sends line as input.
210 Return not at end copies rest of line to end and sends it. 210 Return not at end copies rest of line to end and sends it.
211 Setting mode variable comint-eol-on-send means jump to the end of the line 211 Setting variable `comint-eol-on-send' means jump to the end of the line
212 before submitting new input. 212 before submitting new input.
213 213
214 This mode is typically customised to create inferior-lisp-mode, 214 This mode is typically customised to create Inferior Lisp mode,
215 shell-mode, etc.. This can be done by setting the hooks 215 Shell mode, etc. This can be done by setting the hooks
216 comint-input-sentinel, comint-input-filter, comint-input-sender and 216 `comint-input-sentinel', `comint-input-filter', `comint-input-sender' and
217 comint-get-old-input to appropriate functions, and the variable 217 `comint-get-old-input' to appropriate functions, and the variable
218 comint-prompt-regexp to the appropriate regular expression. 218 `comint-prompt-regexp' to the appropriate regular expression.
219 219
220 An input history is maintained of size comint-input-ring-size, and 220 An input history is maintained of size `comint-input-ring-size', and
221 can be accessed with the commands comint-next-input [\\[comint-next-input]] and 221 can be accessed with the commands \\[comint-next-input] and \\[comint-previous-input].
222 comint-previous-input [\\[comint-previous-input]]. Commands not keybound by 222 Commands with no default key bindings include `send-invisible',
223 default are send-invisible, comint-dynamic-complete, and 223 `comint-dynamic-complete', and `comint-list-dynamic-completions'.
224 comint-list-dynamic-completions.
225 224
226 If you accidentally suspend your process, use \\[comint-continue-subjob] 225 If you accidentally suspend your process, use \\[comint-continue-subjob]
227 to continue it. 226 to continue it.
228 227
229 \\{comint-mode-map} 228 \\{comint-mode-map}
285 284
286 ;;; This function is used to make a full copy of the comint mode map, 285 ;;; This function is used to make a full copy of the comint mode map,
287 ;;; so that client modes won't interfere with each other. This function 286 ;;; so that client modes won't interfere with each other. This function
288 ;;; isn't necessary in emacs 18.5x, but we keep it around for 18.4x versions. 287 ;;; isn't necessary in emacs 18.5x, but we keep it around for 18.4x versions.
289 (defun full-copy-sparse-keymap (km) 288 (defun full-copy-sparse-keymap (km)
290 "Recursively copy the sparse keymap KM" 289 "Recursively copy the sparse keymap KM."
291 (cond ((consp km) 290 (cond ((consp km)
292 (cons (full-copy-sparse-keymap (car km)) 291 (cons (full-copy-sparse-keymap (car km))
293 (full-copy-sparse-keymap (cdr km)))) 292 (full-copy-sparse-keymap (cdr km))))
294 (t km))) 293 (t km)))
295 294
296 (defun comint-check-proc (buffer) 295 (defun comint-check-proc (buffer)
297 "True if there is a process associated w/buffer BUFFER, and 296 "True if there is a living process associated w/buffer BUFFER.
298 it is alive (status RUN or STOP). BUFFER can be either a buffer or the 297 Living means the status is `run' or `stop'.
299 name of one" 298 BUFFER can be either a buffer or the name of one."
300 (let ((proc (get-buffer-process buffer))) 299 (let ((proc (get-buffer-process buffer)))
301 (and proc (memq (process-status proc) '(run stop))))) 300 (and proc (memq (process-status proc) '(run stop)))))
302 301
303 ;;; Note that this guy, unlike shell.el's make-shell, barfs if you pass it () 302 ;;; Note that this guy, unlike shell.el's make-shell, barfs if you pass it ()
304 ;;; for the second argument (program). 303 ;;; for the second argument (program).
318 (comint-mode)) ; Install local vars, mode, keymap, ... 317 (comint-mode)) ; Install local vars, mode, keymap, ...
319 (comint-exec buffer name program startfile switches))) 318 (comint-exec buffer name program startfile switches)))
320 buffer)) 319 buffer))
321 320
322 (defun comint-exec (buffer name command startfile switches) 321 (defun comint-exec (buffer name command startfile switches)
323 "Fires up a process in buffer for comint modes. 322 "Start up a process in buffer BUFFER for comint modes.
324 Blasts any old process running in the buffer. Doesn't set the buffer mode. 323 Blasts any old process running in the buffer. Doesn't set the buffer mode.
325 You can use this to cheaply run a series of processes in the same comint 324 You can use this to cheaply run a series of processes in the same comint
326 buffer. The hook comint-exec-hook is run after each exec." 325 buffer. The hook `comint-exec-hook' is run after each exec."
327 (save-excursion 326 (save-excursion
328 (set-buffer buffer) 327 (set-buffer buffer)
329 (let ((proc (get-buffer-process buffer))) ; Blast any old process. 328 (let ((proc (get-buffer-process buffer))) ; Blast any old process.
330 (if proc (delete-process proc))) 329 (if proc (delete-process proc)))
331 ;; Crank up a new process 330 ;; Crank up a new process
591 (defun comint-send-input () 590 (defun comint-send-input ()
592 "Send input to process. 591 "Send input to process.
593 After the process output mark, sends all text from the process mark to 592 After the process output mark, sends all text from the process mark to
594 point as input to the process. Before the process output mark, calls value 593 point as input to the process. Before the process output mark, calls value
595 of variable `comint-get-old-input' to retrieve old input, copies it to the 594 of variable `comint-get-old-input' to retrieve old input, copies it to the
596 process mark, and sends it. If variable `comint-process-echoes' is `nil', 595 process mark, and sends it. If variable `comint-process-echoes' is nil,
597 a terminal newline is also inserted into the buffer and sent to the process 596 a terminal newline is also inserted into the buffer and sent to the process
598 \(if it is non-`nil', all text from the process mark to point is deleted, 597 \(if it is non-nil, all text from the process mark to point is deleted,
599 since it is assumed the remote process will re-echo it). The value of 598 since it is assumed the remote process will re-echo it).
600 variable `comint-input-sentinel' is called on the input before sending it. 599
601 The input is entered into the input history ring, if the value of variable 600 The value of variable `comint-input-sentinel' is called on the input
602 `comint-input-filter' returns non-`nil' when called on the input. 601 before sending it. The input is entered into the input history ring,
603 602 if the value of variable `comint-input-filter' returns non-nil when
604 If variable `comint-eol-on-send' is non-`nil', then point is moved to the 603 called on the input.
604
605 If variable `comint-eol-on-send' is non-nil, then point is moved to the
605 end of line before sending the input. 606 end of line before sending the input.
606 607
607 `comint-get-old-input', `comint-input-sentinel', and `comint-input-filter' 608 `comint-get-old-input', `comint-input-sentinel', and `comint-input-filter'
608 are chosen according to the command interpreter running in the buffer. E.g., 609 are chosen according to the command interpreter running in the buffer. E.g.,
609 If the interpreter is the csh, 610 If the interpreter is the csh,
667 (setq obeg (+ obeg nchars))) 668 (setq obeg (+ obeg nchars)))
668 (if (<= (point) oend) 669 (if (<= (point) oend)
669 (setq oend (+ oend nchars))) 670 (setq oend (+ oend nchars)))
670 671
671 (insert-before-markers string) 672 (insert-before-markers string)
673 ;; Don't insert initial prompt outside the top of the window.
674 (if (= (window-start (selected-window)) (point))
675 (set-window-start (selected-window) (- (point) (length string))))
676
672 (and comint-last-input-end 677 (and comint-last-input-end
673 (marker-buffer comint-last-input-end) 678 (marker-buffer comint-last-input-end)
674 (= (point) comint-last-input-end) 679 (= (point) comint-last-input-end)
675 (set-marker comint-last-input-end 680 (set-marker comint-last-input-end
676 (- comint-last-input-end nchars))) 681 (- comint-last-input-end nchars)))
680 (narrow-to-region obeg oend) 685 (narrow-to-region obeg oend)
681 (goto-char opoint) 686 (goto-char opoint)
682 (set-buffer obuf))) 687 (set-buffer obuf)))
683 688
684 (defun comint-get-old-input-default () 689 (defun comint-get-old-input-default ()
685 "Default for comint-get-old-input. 690 "Default for `comint-get-old-input'.
686 Take the current line, and discard any initial text matching 691 Take the current line, and discard any initial text matching
687 comint-prompt-regexp." 692 `comint-prompt-regexp'."
688 (save-excursion 693 (save-excursion
689 (beginning-of-line) 694 (beginning-of-line)
690 (comint-skip-prompt) 695 (comint-skip-prompt)
691 (let ((beg (point))) 696 (let ((beg (point)))
692 (end-of-line) 697 (end-of-line)
693 (buffer-substring beg (point))))) 698 (buffer-substring beg (point)))))
694 699
695 (defun comint-skip-prompt () 700 (defun comint-skip-prompt ()
696 "Skip past the text matching regexp comint-prompt-regexp. 701 "Skip past the text matching regexp `comint-prompt-regexp'.
697 If this takes us past the end of the current line, don't skip at all." 702 If this takes us past the end of the current line, don't skip at all."
698 (let ((eol (save-excursion (end-of-line) (point)))) 703 (let ((eol (save-excursion (end-of-line) (point))))
699 (if (and (looking-at comint-prompt-regexp) 704 (if (and (looking-at comint-prompt-regexp)
700 (<= (match-end 0) eol)) 705 (<= (match-end 0) eol))
701 (goto-char (match-end 0))))) 706 (goto-char (match-end 0)))))
712 (<= proc-pos (point)))) 717 (<= proc-pos (point))))
713 718
714 (defun comint-simple-send (proc string) 719 (defun comint-simple-send (proc string)
715 "Default function for sending to PROC input STRING. 720 "Default function for sending to PROC input STRING.
716 This just sends STRING plus a newline. To override this, 721 This just sends STRING plus a newline. To override this,
717 set the hook COMINT-INPUT-SENDER." 722 set the hook `comint-input-sender'."
718 (comint-send-string proc string) 723 (comint-send-string proc string)
719 (comint-send-string proc "\n")) 724 (comint-send-string proc "\n"))
720 725
721 (defun comint-bol (arg) 726 (defun comint-bol (arg)
722 "Goes to the beginning of line, then skips past the prompt, if any. 727 "Goes to the beginning of line, then skips past the prompt, if any.
723 If a prefix argument is given (\\[universal-argument]), then no prompt skip 728 If a prefix argument is given (\\[universal-argument]), then no prompt skip
724 -- go straight to column 0. 729 -- go straight to column 0.
725 730
726 The prompt skip is done by skipping text matching the regular expression 731 The prompt skip is done by skipping text matching the regular expression
727 comint-prompt-regexp, a buffer local variable. 732 `comint-prompt-regexp', a buffer local variable.
728 733
729 If you don't like this command, reset c-a to beginning-of-line 734 If you don't like this command, bind C-a to `beginning-of-line'
730 in your hook, comint-mode-hook." 735 in your hook, `comint-mode-hook'."
731 (interactive "P") 736 (interactive "P")
732 (beginning-of-line) 737 (beginning-of-line)
733 (if (null arg) (comint-skip-prompt))) 738 (if (null arg) (comint-skip-prompt)))
734 739
735 ;;; These two functions are for entering text you don't want echoed or 740 ;;; These two functions are for entering text you don't want echoed or
739 (defun comint-read-noecho (prompt &optional stars) 744 (defun comint-read-noecho (prompt &optional stars)
740 "Read a single line of text from user without echoing, and return it. 745 "Read a single line of text from user without echoing, and return it.
741 Prompt with argument PROMPT, a string. Optional argument STARS causes 746 Prompt with argument PROMPT, a string. Optional argument STARS causes
742 input to be echoed with '*' characters on the prompt line. Input ends with 747 input to be echoed with '*' characters on the prompt line. Input ends with
743 RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line. C-g aborts (if 748 RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line. C-g aborts (if
744 inhibit-quit is set because e.g. this function was called from a process 749 `inhibit-quit' is set because e.g. this function was called from a process
745 filter and C-g is pressed, this function will return `nil', rather than a 750 filter and C-g is pressed, this function returns nil rather than a string).
746 string).
747 751
748 Note that the keystrokes comprising the text can still be recovered 752 Note that the keystrokes comprising the text can still be recovered
749 (temporarily) with \\[view-lossage]. This may be a security bug for some 753 \(temporarily) with \\[view-lossage]. This may be a security bug for some
750 applications." 754 applications."
751 (let ((ans "") 755 (let ((ans "")
752 (c 0) 756 (c 0)
753 (echo-keystrokes 0) 757 (echo-keystrokes 0)
754 (cursor-in-echo-area t) 758 (cursor-in-echo-area t)
785 (message "") 789 (message "")
786 ans))) 790 ans)))
787 791
788 (defun send-invisible (str) 792 (defun send-invisible (str)
789 "Read a string without echoing. 793 "Read a string without echoing.
790 Then send it to the process running in the current buffer. A new-line 794 Then send it to the process running in the current buffer. A new-line
791 is additionally sent. String is not saved on comint input history list. 795 is additionally sent. String is not saved on comint input history list.
792 Security bug: your string can still be temporarily recovered with 796 Security bug: your string can still be temporarily recovered with
793 \\[view-lossage]." 797 \\[view-lossage]."
794 ; (interactive (list (comint-read-noecho "Enter non-echoed text"))) 798 ; (interactive (list (comint-read-noecho "Enter non-echoed text")))
795 (interactive "P") ; Defeat snooping via C-x esc 799 (interactive "P") ; Defeat snooping via C-x esc
796 (let ((proc (get-buffer-process (current-buffer)))) 800 (let ((proc (get-buffer-process (current-buffer))))
802 806
803 807
804 ;;; Low-level process communication 808 ;;; Low-level process communication
805 809
806 (defvar comint-input-chunk-size 512 810 (defvar comint-input-chunk-size 512
807 "*Long inputs send to comint processes are broken up into chunks of this size. 811 "*Long inputs are sent to comint processes in chunks of this size.
808 If your process is choking on big inputs, try lowering the value.") 812 If your process is choking on big inputs, try lowering the value.")
809 813
810 (defun comint-send-string (proc str) 814 (defun comint-send-string (proc str)
811 "Send PROCESS the contents of STRING as input. 815 "Send PROCESS the contents of STRING as input.
812 This is equivalent to process-send-string, except that long input strings 816 This is equivalent to `process-send-string', except that long input strings
813 are broken up into chunks of size comint-input-chunk-size. Processes 817 are broken up into chunks of size `comint-input-chunk-size'. Processes
814 are given a chance to output between chunks. This can help prevent processes 818 are given a chance to output between chunks. This can help prevent processes
815 from hanging when you send them long inputs on some OS's." 819 from hanging when you send them long inputs on some OS's."
816 (let* ((len (length str)) 820 (let* ((len (length str))
817 (i (min len comint-input-chunk-size))) 821 (i (min len comint-input-chunk-size)))
818 (process-send-string proc (substring str 0 i)) 822 (process-send-string proc (substring str 0 i))
819 (while (< i len) 823 (while (< i len)
822 (process-send-string proc (substring str i (min len next-i))) 826 (process-send-string proc (substring str i (min len next-i)))
823 (setq i next-i))))) 827 (setq i next-i)))))
824 828
825 (defun comint-send-region (proc start end) 829 (defun comint-send-region (proc start end)
826 "Sends to PROC the region delimited by START and END. 830 "Sends to PROC the region delimited by START and END.
827 This is a replacement for process-send-region that tries to keep 831 This is a replacement for `process-send-region' that tries to keep
828 your process from hanging on long inputs. See comint-send-string." 832 your process from hanging on long inputs. See `comint-send-string'."
829 (comint-send-string proc (buffer-substring start end))) 833 (comint-send-string proc (buffer-substring start end)))
830 834
831 835
832 ;;; Random input hackage 836 ;;; Random input hackage
833 837
1010 ;;; '(lisp-mode) t)) 1014 ;;; '(lisp-mode) t))
1011 1015
1012 ;;; This is pretty stupid about strings. It decides we're in a string 1016 ;;; This is pretty stupid about strings. It decides we're in a string
1013 ;;; if there's a quote on both sides of point on the current line. 1017 ;;; if there's a quote on both sides of point on the current line.
1014 (defun comint-extract-string () 1018 (defun comint-extract-string ()
1015 "Returns string around POINT that starts the current line or nil." 1019 "Return string around POINT that starts the current line, or nil."
1016 (save-excursion 1020 (save-excursion
1017 (let* ((point (point)) 1021 (let* ((point (point))
1018 (bol (progn (beginning-of-line) (point))) 1022 (bol (progn (beginning-of-line) (point)))
1019 (eol (progn (end-of-line) (point))) 1023 (eol (progn (end-of-line) (point)))
1020 (start (progn (goto-char point) 1024 (start (progn (goto-char point)
1108 ;;; Commands like this are fine things to put in load hooks if you 1112 ;;; Commands like this are fine things to put in load hooks if you
1109 ;;; want them present in specific modes. 1113 ;;; want them present in specific modes.
1110 1114
1111 1115
1112 (defun comint-match-partial-pathname () 1116 (defun comint-match-partial-pathname ()
1113 "Returns the filename at point or causes an error." 1117 "Return the filename at point, or signal an error."
1114 (save-excursion 1118 (save-excursion
1115 (if (re-search-backward "[^~/A-Za-z0-9_.$#,=-]" nil 'move) 1119 (if (re-search-backward "[^~/A-Za-z0-9_.$#,=-]" nil 'move)
1116 (forward-char 1)) 1120 (forward-char 1))
1117 ;; Anchor the search forwards. 1121 ;; Anchor the search forwards.
1118 (if (not (looking-at "[~/A-Za-z0-9_.$#,=-]")) (error "")) 1122 (if (not (looking-at "[~/A-Za-z0-9_.$#,=-]")) (error ""))
1120 (substitute-in-file-name 1124 (substitute-in-file-name
1121 (buffer-substring (match-beginning 0) (match-end 0))))) 1125 (buffer-substring (match-beginning 0) (match-end 0)))))
1122 1126
1123 1127
1124 (defun comint-replace-by-expanded-filename () 1128 (defun comint-replace-by-expanded-filename ()
1125 "Expand the filename at point. 1129 "Expand the filename at point.
1126 Replace the filename with an expanded, canonicalised, and completed 1130 Replace the filename with an expanded, canonicalised, and completed
1127 replacement. 1131 replacement.
1128 \"Expanded\" means environment variables (e.g., $HOME) and ~'s are 1132 \"Expanded\" means environment variables (e.g., $HOME) and ~'s are
1129 replaced with the corresponding directories. \"Canonicalised\" means .. 1133 replaced with the corresponding directories. \"Canonicalised\" means ..
1130 and \. are removed, and the filename is made absolute instead of relative. 1134 and \. are removed, and the filename is made absolute instead of relative.
1131 See functions expand-file-name and substitute-in-file-name. See also 1135 See functions `expand-file-name' and `substitute-in-file-name'. See also
1132 comint-dynamic-complete." 1136 `comint-dynamic-complete'."
1133 (interactive) 1137 (interactive)
1134 (let* ((pathname (comint-match-partial-pathname)) 1138 (let* ((pathname (comint-match-partial-pathname))
1135 (pathdir (file-name-directory pathname)) 1139 (pathdir (file-name-directory pathname))
1136 (pathnondir (file-name-nondirectory pathname)) 1140 (pathnondir (file-name-nondirectory pathname))
1137 (completion (file-name-completion pathnondir 1141 (completion (file-name-completion pathnondir