Skip to content

Commit

Permalink
Rename easysession-mode-line -> easysession-mode-line-misc-info
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescherti committed Sep 14, 2024
1 parent bc4bd7a commit 9375b30
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,18 @@ The `easysession` package can be installed from MELPA by adding the following to
(use-package easysession
:ensure t
:custom
;; Interval between automatic session saves
(easysession-save-interval (* 10 60))
(easysession-mode-line t)
;; Make the current session name appear in the mode-line
(easysession-mode-line-misc-info t)
:init
(add-hook 'after-init-hook #'easysession-load-including-geometry 98)
(add-hook 'after-init-hook #'easysession-save-mode 99))
```

Note that:
- `easysession-load-including-geometry` is not needed after Emacs is loaded if you do not want EasySession to move or resize the Emacs frame when switching sessions. Instead, use `easysession-switch-to` or `easysession-load` to switch to another session or reload the current session without resizing or moving the Emacs frames.
- `easysession-mode-line` determines whether the current session name appears in the mode line by adding `easysession` to `mode-line-misc-info`. Alternatively, `easysession-save-mode-lighter-show-session-name` can be used to display the session name in the lighter.
- `easysession-mode-line` determines whether the current session name appears in the mode line by adding EasySession to `mode-line-misc-info`. Alternatively, the `easysession-save-mode-lighter-show-session-name` can be set to `t` to make EasySession display the session name in the lighter.
- The `easysession-save-mode` ensures that the current session is automatically saved every `easysession-save-interval` seconds and when emacs quits.
- The `easysession-save-interval` variable determines the interval between automatic session saves. Setting it to nil disables timer-based autosaving, causing `easysession-save-mode` to save only when Emacs exits.

Expand Down
23 changes: 11 additions & 12 deletions easysession.el
Original file line number Diff line number Diff line change
Expand Up @@ -122,34 +122,33 @@ activated when `easysession-save-mode' is enabled."
'((t :inherit font-lock-constant-face :weight bold))
"Face used in the mode-line to indicate the current session.")

(defcustom easysession-mode-line-format '(" ["
easysession-mode-line-prefix
":"
easysession-mode-line-session-name
"] ")
(defcustom easysession-mode-line-misc-info-format
'(" [" easysession-mode-line-prefix ":"
easysession-mode-line-session-name "] ")
"Mode-line format used to display the session name."
:type 'sexp
:group 'easysession
:set (lambda (symbol value)
(set symbol value)
(setq mode-line-misc-info
(assq-delete-all 'easysession-mode-line mode-line-misc-info))
(add-to-list 'mode-line-misc-info `(easysession-mode-line
(assq-delete-all 'easysession-mode-line-misc-info
mode-line-misc-info))
(add-to-list 'mode-line-misc-info `(easysession-mode-line-misc-info
,value))))
(put 'easysession-mode-line-format 'risky-local-variable t)
(put 'easysession-mode-line-misc-info-format 'risky-local-variable t)

(defcustom easysession-mode-line nil
(defcustom easysession-mode-line-misc-info nil
"If non-nil, add `easysession` to `mode-line-misc-info'. If nil, remove it."
:type 'boolean
:group 'easysession
:set (lambda (symbol value)
(set symbol value)
(setq mode-line-misc-info
(assq-delete-all
'easysession-mode-line mode-line-misc-info))
'easysession-mode-line-misc-info mode-line-misc-info))
(add-to-list 'mode-line-misc-info
`(easysession-mode-line
,easysession-mode-line-format))))
`(easysession-mode-line-misc-info
easysession-mode-line-misc-info-format))))

;; Lighter
(defvar easysession-save-mode-lighter " EasySeSave"
Expand Down

0 comments on commit 9375b30

Please sign in to comment.