emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 6eac401: Make ielm accept an optional buffer name p


From: Bozhidar Batsov
Subject: [Emacs-diffs] master 6eac401: Make ielm accept an optional buffer name param
Date: Sat, 21 Jul 2018 07:04:33 -0400 (EDT)

branch: master
commit 6eac401c238b9c98550c645f3c60df9a9668dc61
Author: Bozhidar Batsov <address@hidden>
Commit: Bozhidar Batsov <address@hidden>

    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).
---
 lisp/ielm.el | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lisp/ielm.el b/lisp/ielm.el
index b4ad69e..8d1efcd 100644
--- a/lisp/ielm.el
+++ b/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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]