*** New basic face 'fixed-pitch-serif', for a fixed-width font with serifs.
The Info-quoted and tex-verbatim faces now default to inheriting from it.
+** New built-in function `mapcan' which avoids unnecessary consing (and garbage
+ collection).
+
\f
* Changes in Emacs 25.2 on Non-Free Operating Systems
This makes it appear more like the results of a `semantic-find-' call.
This is like `semanticdb-strip-find-results', except the input list RESULTS
will be changed."
- (apply #'nconc (mapcar #'cdr results)))
+ (mapcan #'cdr results))
(defun semanticdb-find-results-p (resultp)
"Non-nil if RESULTP is in the form of a semanticdb search result.
(if (null (cdr args))
args
`("(" ,@args
- ,@(apply #'nconc (mapcar (lambda (s) `("-o" "-name" ,s)) pat))
+ ,@(mapcan (lambda (s) `("-o" "-name" ,s)) pat)
")"))))))
(defvar grepflags)
(lambda (s) (concat s "/"))
grep-find-ignored-directories)
grep-find-ignored-files))
- (xrefs (cl-mapcan
+ (xrefs (mapcan
(lambda (file)
(xref-collect-matches regexp "*" file
(and (file-directory-p file)
(defun cl-mapcan (cl-func cl-seq &rest cl-rest)
"Like `cl-mapcar', but nconc's together the values returned by the function.
\n(fn FUNCTION SEQUENCE...)"
- (apply 'nconc (apply 'cl-mapcar cl-func cl-seq cl-rest)))
+ (if cl-rest
+ (apply 'nconc (apply 'cl-mapcar cl-func cl-seq cl-rest))
+ (mapcan cl-func cl-seq)))
;;;###autoload
(defun cl-mapcon (cl-func cl-list &rest cl-rest)
every
some
mapcon
- mapcan
mapl
maplist
map
(defun gnus-registry-sort-addresses (&rest addresses)
"Return a normalized and sorted list of ADDRESSES."
- (sort (apply 'nconc (mapcar 'gnus-registry-extract-addresses addresses))
- 'string-lessp))
+ (sort (mapcan 'gnus-registry-extract-addresses addresses) 'string-lessp))
(defun gnus-registry-simplify-subject (subject)
(if (stringp subject)
(defun gnus-articles-in-thread (thread)
"Return the list of articles in THREAD."
(cons (mail-header-number (car thread))
- (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
+ (mapcan 'gnus-articles-in-thread (cdr thread))))
(defun gnus-remove-thread (id &optional dont-remove)
"Remove the thread that has ID in it."
heads))
nil))
(setq ,result-tail (cdr ,result-tail)
- ,@(apply 'nconc (mapcar (lambda (h) (list h (list 'cdr h))) heads))))
+ ,@(mapcan (lambda (h) (list h (list 'cdr h))) heads)))
(cdr ,result)))
`(mapcar ,function ,seq1)))
;; Builtin & operation.
((eq (car split) '&)
- (apply 'nconc (mapcar 'nnmail-split-it (cdr split))))
+ (mapcan 'nnmail-split-it (cdr split)))
;; Builtin | operation.
((eq (car split) '|)
(let ((others-list
(mouse-buffer-menu-alist
;; we don't need split-by-major-mode any more,
- ;; so we can ditch it with nconc.
- (apply 'nconc (mapcar 'cddr split-by-major-mode)))))
+ ;; so we can ditch it with nconc (mapcan).
+ (mapcan 'cddr split-by-major-mode))))
(and others-list
(setq subdivided-menus
(cons (cons "Others" others-list)
(push uidl new))
(decf i)))
(pop3-uidl
- (setq new (apply 'nconc (mapcar (lambda (elt) (list elt ctime))
- pop3-uidl)))))
+ (setq new (mapcan (lambda (elt) (list elt ctime)) pop3-uidl))))
(when new (setq mod t))
;; List expirable messages and delete them from the data to be saved.
(setq ctime (when (numberp pop3-leave-mail-on-server)
PATH gives the directories in which to search for files with
extension EXTN. Normally EXTN is given as the regular expression
\"\\.java$\" ."
- (apply 'nconc (mapcar (lambda (d)
- (when (file-directory-p d)
- (directory-files d t extn nil)))
- path)))
+ (mapcan (lambda (d)
+ (when (file-directory-p d)
+ (directory-files d t extn nil)))
+ path))
;; Move point past whitespace.
(defun gud-jdb-skip-whitespace ()
result)))
(defun hif-delimit (lis atom)
- (nconc (cl-mapcan (lambda (l) (list l atom))
- (butlast lis))
+ (nconc (mapcan (lambda (l) (list l atom))
+ (butlast lis))
(last lis)))
;; Perform token replacement:
(substring arg 0 (match-end 1))
arg))))
-(require 'cl-lib)
-
(eval-when-compile ; to avoid compiler warnings
+ (require 'cl-lib)
(require 'dired)
(require 'apropos))
(mapcar 'woman-Cyg-to-Win (woman-parse-man.conf)))
((string-match-p ";" paths)
;; Assume DOS-style path-list...
- (cl-mapcan ; splice list into list
+ (mapcan ; splice list into list
(lambda (x)
(if x
(list x)
(list paths))
(t
;; Assume UNIX/Cygwin-style path-list...
- (cl-mapcan ; splice list into list
+ (mapcan ; splice list into list
(lambda (x)
(mapcar 'woman-Cyg-to-Win
(if x (list x) (woman-parse-man.conf))))
(let ((path-separator ":"))
(parse-colon-path paths)))))
;; Assume host-default-style path-list...
- (cl-mapcan ; splice list into list
+ (mapcan ; splice list into list
(lambda (x) (if x (list x) (woman-parse-man.conf)))
(parse-colon-path (or paths "")))))
return sequence;
}
+
+DEFUN ("mapcan", Fmapcan, Smapcan, 2, 2, 0,
+ doc: /* Apply FUNCTION to each element of SEQUENCE, and concatenate
+the results by altering them (using `nconc').
+SEQUENCE may be a list, a vector, a bool-vector, or a string. */)
+ (Lisp_Object function, Lisp_Object sequence)
+{
+ register EMACS_INT leni;
+ register Lisp_Object *args;
+ Lisp_Object ret;
+ USE_SAFE_ALLOCA;
+
+ if (CHAR_TABLE_P (sequence))
+ wrong_type_argument (Qlistp, sequence);
+
+ leni = XFASTINT (Flength (sequence));
+ SAFE_ALLOCA_LISP (args, leni);
+ mapcar1 (leni, args, function, sequence);
+ ret = Fnconc (leni, args);
+
+ SAFE_FREE ();
+
+ return ret;
+}
\f
/* This is how C code calls `yes-or-no-p' and allows the user
to redefine it. */
defsubr (&Snconc);
defsubr (&Smapcar);
defsubr (&Smapc);
+ defsubr (&Smapcan);
defsubr (&Smapconcat);
defsubr (&Syes_or_no_p);
defsubr (&Sload_average);