4 ms·
Based on comint, M-x su: (defvar explicit-su-file-name "/bin/su") (defvar explicit-su-args '("-")) (defun su (&optional buffer) (interactive (l
by e40 16y ago
Based on comint, M-x su:
(defvar explicit-su-file-name "/bin/su")
(defvar explicit-su-args '("-"))
(defun su (&optional buffer)
(interactive
(list
(and current-prefix-arg
(prog1
(read-buffer "SU buffer: "
(generate-new-buffer-name "*su*"))
(if (file-remote-p default-directory)
;; It must be possible to declare a local default-directory.
(setq default-directory
(expand-file-name
(read-file-name
"Default directory: " default-directory default-directory
t nil 'file-directory-p))))))))
(setq buffer (get-buffer-create (or buffer "*su*")))
;; Pop to buffer, so that the buffer's window will be correctly set
;; when we call comint (so that comint sets the COLUMNS env var properly).
(pop-to-buffer buffer)
(unless (comint-check-proc buffer)
(let* ((prog explicit-su-file-name)
(name (file-name-nondirectory prog))
(startfile (concat "~/.emacs_" name))
(xargs-name (intern-soft (concat "explicit-" name "-args"))))
(apply 'make-comint-in-buffer "su" buffer prog
(if (file-exists-p startfile) startfile)
(if (and xargs-name (boundp xargs-name))
(symbol-value xargs-name)
'("-i")))
(shell-mode)))
buffer)
- jrockway 16y ago;; It must be possible to declare a local default-directory. make-local-variable is an interactive built-in function in `C source code'. (make-local-variable VARIABLE) Make VARIABLE have a separate value in the current buffer. Other buffers will continue to share a common default value. (The buffer-local value of VARIABLE starts out as the same value VARIABLE previously had. If VARIABLE was void, it remains void.) Return VARIABLE.