mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-28 07:45:00 +00:00
Make ielm accept an optional buffer name param
The ielm buffer name was hardcoded which made it hard for programs to interactively create ielm buffers with different names and switch to them (e.g. perhaps you want to have one ielm buffer for each of the Elisp projects you're working on).
This commit is contained in:
parent
03e3440dbb
commit
6eac401c23
14
lisp/ielm.el
14
lisp/ielm.el
@ -612,17 +612,19 @@ Customized bindings may be defined in `ielm-map', which currently contains:
|
||||
;;; User command
|
||||
|
||||
;;;###autoload
|
||||
(defun ielm nil
|
||||
(defun ielm (&optional buf-name)
|
||||
"Interactively evaluate Emacs Lisp expressions.
|
||||
Switches to the buffer `*ielm*', or creates it if it does not exist.
|
||||
Switches to the buffer named BUF-NAME if provided (`*ielm*' by default),
|
||||
or creates it if it does not exist.
|
||||
See `inferior-emacs-lisp-mode' for details."
|
||||
(interactive)
|
||||
(let (old-point)
|
||||
(unless (comint-check-proc "*ielm*")
|
||||
(with-current-buffer (get-buffer-create "*ielm*")
|
||||
(let (old-point
|
||||
(buf-name (or buf-name "*ielm*")))
|
||||
(unless (comint-check-proc buf-name)
|
||||
(with-current-buffer (get-buffer-create buf-name)
|
||||
(unless (zerop (buffer-size)) (setq old-point (point)))
|
||||
(inferior-emacs-lisp-mode)))
|
||||
(pop-to-buffer-same-window "*ielm*")
|
||||
(pop-to-buffer-same-window buf-name)
|
||||
(when old-point (push-mark old-point))))
|
||||
|
||||
(provide 'ielm)
|
||||
|
Loading…
Reference in New Issue
Block a user