Skip to content

Commit

Permalink
Add special set function so that customizing display options will tak…
Browse files Browse the repository at this point in the history
…e effect immediately
  • Loading branch information
Ivan Andrus committed Apr 7, 2024
1 parent 16d3b55 commit 52cde64
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions memento-mori.el
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,16 @@ Really, it adds it to the `global-mode-string', which usually
appears in the mode line, however, if you have customized your
mode line it may not appear."
:group 'memento-mori
:type 'boolean)
:type 'boolean
:set #'memento-mori--set-value-and-update-display
:initialize #'custom-initialize-default)

(defcustom memento-mori-display-in-frame-title nil
"If non-nil, `memento-mori-mode' will add mementos to the frame title."

Check warning on line 66 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (25.1, false)

Disambiguate memento-mori-mode by preceding w/ function,command,variable,option or symbol.

Check warning on line 66 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (24.4, false)

Disambiguate memento-mori-mode by preceding w/ function,command,variable,option or symbol.

Check warning on line 66 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (26.2, false)

Disambiguate memento-mori-mode by preceding w/ function,command,variable,option or symbol.

Check warning on line 66 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (26.1, false)

Disambiguate memento-mori-mode by preceding w/ function,command,variable,option or symbol.

Check warning on line 66 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (27.2, false)

Disambiguate memento-mori-mode by preceding w/ function,command,variable,option or symbol.

Check warning on line 66 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (26.3, false)

Disambiguate memento-mori-mode by preceding w/ function,command,variable,option or symbol.

Check warning on line 66 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (27.1, false)

Disambiguate memento-mori-mode by preceding w/ function,command,variable,option or symbol.
:group 'memento-mori
:type 'boolean)
:type 'boolean
:set #'memento-mori--set-value-and-update-display
:initialize #'custom-initialize-default)

(defcustom memento-mori-initial-scratch-message nil
"If non-nil, overwrite the value of `initial-scratch-message' with this.
Expand All @@ -73,6 +77,7 @@ If this contains a %q it will be replaced with a random quote from
Ultimately, it will be displayed as the initial documentation in
*scratch* buffer at startup."
:group 'memento-mori
:type '(choice (text :tag "Scratch message format")
(const :tag "none" nil)))

Expand All @@ -82,7 +87,9 @@ This is deprecated in favor of the more flexible `memento-mori-mementos'.
To use `memento-mori-mementos' customize it, or erase customization of
`memento-mori-birth-date'."
:group 'memento-mori
:type 'string)
:type 'string
:set #'memento-mori--set-value-and-update
:initialize #'custom-initialize-default)
(make-obsolete-variable 'memento-mori-birth-date
'memento-mori-mementos "0.2.1")

Expand Down Expand Up @@ -162,7 +169,9 @@ of precision depending on if it's longer than 10 years or not."
(plist :key-type symbol
:options ((:until string :tag "Date")
(:since string) (:formula function))
:value-type string))))
:value-type string)))
:set #'memento-mori--set-value-and-update
:initialize #'custom-initialize-default)

(define-obsolete-variable-alias 'memento-mori-age-string
'memento-mori-string "0.2.0")
Expand Down Expand Up @@ -251,6 +260,16 @@ The string shown in the mode line and/or frame title when
by the user, but can be used in other places such as org-mode

Check warning on line 260 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (25.1, false)

Lisp symbol ‘org-mode’ should appear in quotes

Check warning on line 260 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (24.4, false)

Lisp symbol `org-mode' should appear in quotes

Check warning on line 260 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (26.2, false)

Lisp symbol ‘org-mode’ should appear in quotes

Check warning on line 260 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (26.1, false)

Lisp symbol ‘org-mode’ should appear in quotes

Check warning on line 260 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (snapshot, false)

Lisp symbol ‘org-mode’ should appear in quotes

Check warning on line 260 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (27.2, false)

Lisp symbol ‘org-mode’ should appear in quotes

Check warning on line 260 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (26.3, false)

Lisp symbol ‘org-mode’ should appear in quotes

Check warning on line 260 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (29.1, false)

Lisp symbol ‘org-mode’ should appear in quotes

Check warning on line 260 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (release-snapshot, false)

Lisp symbol ‘org-mode’ should appear in quotes

Check warning on line 260 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (28.2, false)

Lisp symbol ‘org-mode’ should appear in quotes

Check warning on line 260 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (28.1, false)

Lisp symbol ‘org-mode’ should appear in quotes

Check warning on line 260 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (27.1, false)

Lisp symbol ‘org-mode’ should appear in quotes
agendas to display the current momento.")

(defun memento-mori--set-value-and-update-display (symbol value)
"Function to set display values, so that the display will then be recalculated."

Check warning on line 264 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (25.1, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 264 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (24.4, false)

Argument `symbol' should appear (as SYMBOL) in the doc string

Check warning on line 264 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (26.2, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 264 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (26.1, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 264 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (snapshot, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 264 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (27.2, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 264 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (26.3, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 264 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (29.1, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 264 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (release-snapshot, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 264 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (28.2, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 264 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (28.1, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 264 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (27.1, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string
(set-default-toplevel-value symbol value)

Check failure on line 265 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (25.1, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 265 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (24.4, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 265 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (26.2, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 265 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (26.1, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 265 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (snapshot, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 265 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (27.2, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 265 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (26.3, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 265 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (29.1, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 265 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (release-snapshot, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 265 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (28.2, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 265 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (28.1, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 265 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (27.1, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.
(memento-mori--add-mementos))

(defun memento-mori--set-value-and-update (symbol value)
"Function to set memento config, so that a new memento will be chosen."

Check warning on line 269 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (25.1, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 269 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (24.4, false)

Argument `symbol' should appear (as SYMBOL) in the doc string

Check warning on line 269 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (26.2, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 269 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (26.1, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 269 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (snapshot, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 269 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (27.2, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 269 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (26.3, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 269 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (29.1, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 269 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (release-snapshot, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 269 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (28.2, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 269 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (28.1, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string

Check warning on line 269 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (27.1, false)

Argument ‘symbol’ should appear (as SYMBOL) in the doc string
(set-default-toplevel-value symbol value)

Check failure on line 270 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (25.1, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 270 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (24.4, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 270 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (26.2, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 270 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (26.1, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 270 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (snapshot, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 270 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (27.2, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 270 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (26.3, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 270 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (29.1, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 270 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (release-snapshot, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 270 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (28.2, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 270 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (28.1, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.

Check failure on line 270 in memento-mori.el

View workflow job for this annotation

GitHub Actions / check (27.1, false)

You should depend on (emacs "24.4") if you need `set-default-toplevel-value'.
(memento-mori--update))

(defvar memento-mori--modeline-construct
`(memento-mori-mode
((:propertize
Expand Down

0 comments on commit 52cde64

Please sign in to comment.