ergoemacs / ergoemacs-mode

ergoemacs-mode
ergoemacs.github.io/
GNU General Public License v3.0
293 stars 35 forks source link

Finer-grained control over user vs Emacs buffers. #421

Closed calliecameron closed 8 years ago

calliecameron commented 8 years ago

I use term and magit a lot, and would find it convenient if those buffers were considered user buffers. This patch adds a mechanism for doing that: a user buffer is now one whose name does not start with *, or for which any of the functions in ergoemacs-user-buffer-functions return true; otherwise it is an Emacs buffer.

I'm not sure whether ergoemacs-user-buffer-functions should be populated by default, or if that should be entirely up to the user; here I have set it to nil so that the existing behaviour doesn't change by default. In my own configuration, at least, I would set it to:

(add-to-list
 'ergoemacs-user-buffer-functions
 (lambda (buf)
   (let ((mode (buffer-local-value 'major-mode buf)))
     (or (eq mode 'term-mode)
         (eq mode 'magit-status-mode)))))
mattfidler commented 8 years ago

Thank you for your pull request!

I also think magit buffers should be user buffers. They changed their naming convention so that they start with a * and do not end with one.... Not sure why. It depends on the version of magit used.

If you want to add magit to this list I would appreciate it. It would make the behavior more consistent with past behavior.