all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#18175: files.el: use mapc in (mapcar 'switch-to-buffer ...)
@ 2014-08-02 21:55 Ivan Shmakov
  2014-08-03  0:55 ` Drew Adams
  2014-08-06 17:26 ` Stefan Monnier
  0 siblings, 2 replies; 10+ messages in thread
From: Ivan Shmakov @ 2014-08-02 21:55 UTC (permalink / raw)
  To: 18175

[-- Attachment #1: Type: text/plain, Size: 641 bytes --]

Package:  emacs
Severity: wishlist

	Given that switch-to-buffer returns its argument, /and/ given
	that mapc returns the sequence it’s given, I suggest that the
	(mapcar 'switch-to-buffer LIST) forms in lisp/files.el be
	replaced with (mapc 'switch-to-buffer LIST), – if only to avoid
	the unnecessary consing when the list is effectively copied in
	the mapcar case.

	The lists mapcar is applied to in such cases are returned from
	find-file-noselect, and so, as it seems, are “fresh” ones
	anyway.

	A possible patch is MIMEd.

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff, Size: 1257 bytes --]

diff --git a/lisp/files.el b/lisp/files.el
index 9272e98..e604ce7 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1428,7 +1428,7 @@ automatically choosing a major mode, use \\[find-file-literally]."
                         (confirm-nonexistent-file-or-buffer)))
   (let ((value (find-file-noselect filename nil nil wildcards)))
     (if (listp value)
-	(mapcar 'switch-to-buffer (nreverse value))
+	(mapc 'switch-to-buffer (nreverse value))
       (switch-to-buffer value))))
 
 (defun find-file-other-window (filename &optional wildcards)
@@ -1451,7 +1451,7 @@ expand wildcards (if any) and visit multiple files."
 	(progn
 	  (setq value (nreverse value))
 	  (cons (switch-to-buffer-other-window (car value))
-		(mapcar 'switch-to-buffer (cdr value))))
+		(mapc 'switch-to-buffer (cdr value))))
       (switch-to-buffer-other-window value))))
 
 (defun find-file-other-frame (filename &optional wildcards)
@@ -1474,7 +1474,7 @@ expand wildcards (if any) and visit multiple files."
 	(progn
 	  (setq value (nreverse value))
 	  (cons (switch-to-buffer-other-frame (car value))
-		(mapcar 'switch-to-buffer (cdr value))))
+		(mapc 'switch-to-buffer (cdr value))))
       (switch-to-buffer-other-frame value))))
 
 (defun find-file-existing (filename)

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-01-23 15:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-02 21:55 bug#18175: files.el: use mapc in (mapcar 'switch-to-buffer ...) Ivan Shmakov
2014-08-03  0:55 ` Drew Adams
2014-08-03  8:55   ` Ivan Shmakov
2014-08-03 16:32     ` Drew Adams
2014-08-03 18:25       ` Ivan Shmakov
2014-08-03 18:43         ` Drew Adams
2014-08-06 17:26 ` Stefan Monnier
2014-08-07 19:15   ` Ivan Shmakov
2014-08-07 19:29     ` Stefan Monnier
2015-01-23 15:27       ` Ivan Shmakov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.