Skip to main content
added code fence for lisp to have correct syntax highlighting
Source Link

I am trying to get a list of buffers through elisp. So I created the following function:

(mapcar (function buffer-name) (buffer-list))
(mapcar (function buffer-name) (buffer-list))

This works when I do something like:

(minibuffer-message (mapcar (function buffer-name) (buffer-list)))
(minibuffer-message (mapcar (function buffer-name) (buffer-list)))

However, the following line of code does not work:

(insert (mapcar (function buffer-name) (buffer-list)))
(insert (mapcar (function buffer-name) (buffer-list)))

Q: Could this just be a noob mistake? Is there a better way of doing it?

I am trying to get a list of buffers through elisp. So I created the following function:

(mapcar (function buffer-name) (buffer-list))

This works when I do something like:

(minibuffer-message (mapcar (function buffer-name) (buffer-list)))

However, the following line of code does not work:

(insert (mapcar (function buffer-name) (buffer-list)))

Q: Could this just be a noob mistake? Is there a better way of doing it?

I am trying to get a list of buffers through elisp. So I created the following function:

(mapcar (function buffer-name) (buffer-list))

This works when I do something like:

(minibuffer-message (mapcar (function buffer-name) (buffer-list)))

However, the following line of code does not work:

(insert (mapcar (function buffer-name) (buffer-list)))

Q: Could this just be a noob mistake? Is there a better way of doing it?

Source Link
programking
  • 7.4k
  • 12
  • 43
  • 63

How to get a list of all the buffers in elisp?

I am trying to get a list of buffers through elisp. So I created the following function:

(mapcar (function buffer-name) (buffer-list))

This works when I do something like:

(minibuffer-message (mapcar (function buffer-name) (buffer-list)))

However, the following line of code does not work:

(insert (mapcar (function buffer-name) (buffer-list)))

Q: Could this just be a noob mistake? Is there a better way of doing it?