Skip to content

kickingvegas/casual-bookmarks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://melpa.org/packages/casual-bookmarks-badge.svg

Casual Bookmarks

An opinionated Transient-based user interface for the Emacs Bookmark list.

docs/images/casual-bookmarks-screenshot.png

Motivation

While highly functional, the Emacs bookmark list (list-bookmarks) has a steep learning curve as it has a very diverse command set. Menus are a user interface (UI) affordance that offer users discoverability and recall that can lower its learning curve. While menus are commonly associated with mouse-driven UI, the inclusion of Transient in Emacs core allows for a menu UI that is keyboard-driven. Casual Bookmarks endeavors to offer this as many Emacs users prefer keyboard-driven workflows.

Goals

  • To provide a keyboard-driven menu UI for editing bookmarks.
  • To provide casual access to the Bookmark list command set.

Non-Goals

  • Full coverage of all bookmark list commands. Casual Bookmarks is not intended to be a power user tool.
  • Strict adherence to bookmark list command naming. While Casual Bookmarks is mostly in alignment with bookmark list command naming, there are cases where it will make an opinionated change if the name is deemed too vague or idiomatic.
  • UX Stability (for now). Given that Casual Bookmarks is early in its life-cycle, expect changes to its user experience in terms of menu hierarchy and keybinding choices in future releases.

Requirements

Casual Bookmarks requires usage of

  • Emacs ≥ 29.1
  • Casual Lib ≥ 1.1.0

Casual Bookmarks has been verified with the following configuration.

  • Emacs 29.4 (macOS 14.5, Ubuntu Linux 22.04.4 LTS)

Asks

As Casual Bookmarks is new, we are looking for early adopters! Your feedback is welcome as it will likely impact Casual Bookmarks’s evolution, particularly with regards to UI.

Install

If installed via MELPA then add these lines to your Emacs initialization file with your binding of preference.

(require 'casual-bookmarks) ;; optional
(keymap-set bookmark-bmenu-mode-map "C-o" #'casual-bookmarks-tmenu)

If you use use-package, here is the recipe for installing and configuring it.

(use-package bookmark
  :ensure nil
  :defer t)
(use-package casual-bookmarks
  :ensure t
  :bind (:map bookmark-bmenu-mode-map
              ("C-o" . casual-bookmarks-tmenu)
              ("S" . casual-bookmarks-sortby-tmenu)
              ("J" . bookmark-jump))
  :after (bookmark))

A Note on Package Dependencies

Casual Bookmarks requires Casual Lib which in turn requires a recent installation of Transient 0.6.0+ from either ELPA or MELPA. As an older version of Transient is built-in to the Emacs release, the package manager package.el will not update this package unless the customizable variable package-install-upgrade-built-in is set to t. Set this variable and proceed with installing Casual Bookmarks. Alternately invoking package-install with a prefix (C-u) will temporarily coerce the update of the built-in package. (example: C-u M-x package-install casual-bookmarks)

As Transient is closely tied to Magit, installing the latest version of Magit (via non-GNU ELPA or MELPA) before installing Casual Bookmarks can also pick up the latest version of Transient.

Configuration

Use these keybindings to configure bookmark list to be consistent with keybindings used by Casual Bookmarks.

(keymap-set bookmark-bmenu-mode-map "J" #'bookmark-jump)

Casual Bookmarks also includes the keymap casual-bookmarks-main-menu which inserts a Bookmarks menu into the main menu bar as shown below.

docs/images/bookmarks-main-menu.png

To enable this, add the following configuration to your initialization file.

(require 'casual-bookmarks)
(easy-menu-add-item global-map '(menu-bar)
                    casual-bookmarks-main-menu
                    "Tools")

While not necessary, having the current bookmark highlighted is convenient. Enable hl-line-mode for the bookmark list as shown below.

(require 'hl-line)
(add-hook 'bookmark-bmenu-mode-hook #'hl-line-mode)

Finally, customize the variable bookmark-save-flag to the value 1 to ensure that your bookmark changes are always saved.

The above guidance largely extends the work done in the blog post Using Bookmarks in Emacs like you do in Web Browsers.

Usage

Unicode Symbol Support

docs/images/casual-bookmarks-unicode-screenshot.png

By enabling “Use Unicode Symbols” from the Settings menu, Casual Bookmarks will use Unicode symbols as appropriate in its menus. The following mapping is shown in the table below:

NamePlainUnicode
:previousPrevious
:nextNext
:jumpJump🚀
:beginning-of-bufferBeginning
:end-of-bufferEnd
:backwardBackward
:forwardForward
:narrowNarrow→←
:widenWiden←→

Common Menu Actions

Casual Bookmarks is built using Transient menus and as such adopts much of its default behavior.

Each menu item has a key and a label. The key is what is typed by the user to select the menu item. A key can be prefixed with a meta (M-) or control (C-) key.

Dismissing a menu regardless of how deep you are in sub-menus can be done by entering C-q. A menu can also be dismissed by entering C-g, but this will return you to the parent menu.

If a mouse is available, a menu item can be selected by moving the mouse cursor over its label and pressing down button 1.

Pressing the ? key will toggle help for all the menu items. Press the key of interest to get help for it.

When a Transient menu is raised, a prefix argument (C-u) can be entered before selecting a menu item.

Development

For users who wish to help contribute to Casual Bookmarks or personally customize it for their own usage, please read the developer documentation.

Sponsorship

If you enjoy using Casual Bookmarks, consider making a modest financial contribution to help support its development and maintenance.

docs/images/default-yellow.png

See Also

Casual Bookmarks is part of a suite of user interfaces for different Emacs packages called Casual Suite.

Different interfaces include those for I-Search, Dired, Info, Calc, RE-Builder, IBuffer, and others. Learn more about them today!

Acknowledgments

A heartfelt thanks to all the contributors to Bookmarks and Transient. Casual Bookmarks would not be possible without your efforts.