Skip to content

Emacs package to rename buffers with descriptive names

License

Notifications You must be signed in to change notification settings

oantolin/epithet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

epithet (noun) ep⸱i⸱thet |ˈe-pə-ˌthet also -thət

  1. a characterizing word or phrase accompanying or occurring in place of the name of a person or thing.

Overview

This package provides a function epithet-rename-buffer to rename the current buffer with a descriptive name. The name suggestion is governed by the epithet-suggesters hook variable: each hook should return either a name suggestion or nil, they are called in turn and the first non-nil suggestion is taken.

A cute trick is too add buffer-file-name to epithet-suggesters: this has the effect of suggesting the full path for buffers associated with files.

There are currently suggestion functions for eww, info, help and occur buffers. For eww there are two, in fact, one that suggests the page title and one that suggests the URL (the title is the default).

The epithet-rename-buffer function can be called interactively or added to appropriate hooks to rename automatically. If called interactively you can use the universal prefix argument to get a prompt where you can choose a different name, and the suggested name is available as the default value.

If you want to always rename info, eww, help or occur buffers without manual intervention, use:

(add-hook 'Info-selection-hook #'epithet-rename-buffer)
(add-hook 'eww-after-render-hook #'epithet-rename-buffer)
(add-hook 'help-mode-hook #'epithet-rename-buffer)
(add-hook 'occur-hook #'epithet-rename-buffer) ; not occur-mode-hook
(add-hook 'shell-mode-hook #'epithet-rename-buffer)
(add-hook 'compilation-start-hook #'epithet-rename-buffer-ignoring-arguments)
(add-hook 'compilation-finish-functions #'epithet-rename-buffer-ignoring-arguments)

Due to a quirk in describe-bindings, even though it produces a help mode buffer, having epithet-rename-buffer in the help-mode-hook will not rename the buffer it creates. If you want those buffers renamed automatically too, you should also add this to your configuration:

(defun rename-describe-bindings (&rest _)
  (with-current-buffer (help-buffer)
    (epithet-rename-buffer)))

(advice-add 'describe-bindings :after #'rename-describe-bindings)

About

Emacs package to rename buffers with descriptive names

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published