aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorHolger Dürer <me@hdurer.net>2021-11-02 18:35:38 +0100
committerHolger Dürer <me@hdurer.net>2021-11-06 16:09:19 +0100
commitb9d5d2ee57855653c32fe2fe2a495e5a3a038acf (patch)
treed2bcaff578866455c7a43ca834980be6fbabf1ae /lisp
parent027f24125fae4abc487207c8c81fdc0f20ec711d (diff)
Use `defvar-local` to create buffer-local vars.
This is much cleaner than first using `defvar` immediately followed by `make-variable-buffer-local`.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-async.el15
-rw-r--r--lisp/mastodon-profile.el3
-rw-r--r--lisp/mastodon-tl.el12
-rw-r--r--lisp/mastodon-toot.el24
4 files changed, 19 insertions, 35 deletions
diff --git a/lisp/mastodon-async.el b/lisp/mastodon-async.el
index 56dc230..f7bbdff 100644
--- a/lisp/mastodon-async.el
+++ b/lisp/mastodon-async.el
@@ -55,17 +55,14 @@
(defvar mastodon-tl--display-media-p)
(defvar mastodon-tl--buffer-spec)
-(make-variable-buffer-local
- (defvar mastodon-async--queue "" ;;"*mastodon-async-queue*"
- "The intermediate queue buffer name."))
+(defvar-local mastodon-async--queue "" ;;"*mastodon-async-queue*"
+ "The intermediate queue buffer name.")
-(make-variable-buffer-local
- (defvar mastodon-async--buffer "" ;;"*mastodon-async-buffer*"
- "User facing output buffer name."))
+(defvar-local mastodon-async--buffer "" ;;"*mastodon-async-buffer*"
+ "User facing output buffer name.")
-(make-variable-buffer-local
- (defvar mastodon-async--http-buffer "" ;;""
- "Buffer variable bound to http output."))
+(defvar-local mastodon-async--http-buffer "" ;;""
+ "Buffer variable bound to http output.")
(defun mastodon-async--display-http ()
"Display the async HTTP input buffer."
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el
index 018af21..31499ed 100644
--- a/lisp/mastodon-profile.el
+++ b/lisp/mastodon-profile.el
@@ -62,9 +62,8 @@
(defvar mastodon-tl--update-point)
-(defvar mastodon-profile--account nil
+(defvar-local mastodon-profile--account nil
"The data for the account being described in the current profile buffer.")
-(make-variable-buffer-local 'mastodon-profile--account)
;; this way you can update it with C-M-x:
(defvar mastodon-profile-mode-map
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index b1b7c68..e4c179c 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -82,9 +82,8 @@ By default fixed width fonts are used."
:type '(boolean :tag "Enable using proportional rather than fixed \
width fonts when rendering HTML text"))
-(defvar mastodon-tl--buffer-spec nil
+(defvar-local mastodon-tl--buffer-spec nil
"A unique identifier and functions for each Mastodon buffer.")
-(make-variable-buffer-local 'mastodon-tl--buffer-spec)
(defcustom mastodon-tl--show-avatars nil
"Whether to enable display of user avatars in timelines."
@@ -97,22 +96,19 @@ width fonts when rendering HTML text"))
;; (image-transforms-p))
;; "A boolean value stating whether to show avatars in timelines.")
-(defvar mastodon-tl--update-point nil
+(defvar-local mastodon-tl--update-point nil
"When updating a mastodon buffer this is where new toots will be inserted.
If nil `(point-min)' is used instead.")
-(make-variable-buffer-local 'mastodon-tl--update-point)
(defvar mastodon-tl--display-media-p t
"A boolean value stating whether to show media in timelines.")
-(defvar mastodon-tl--timestamp-next-update nil
+(defvar-local mastodon-tl--timestamp-next-update nil
"The timestamp when the buffer should next be scanned to update the timestamps.")
-(make-variable-buffer-local 'mastodon-tl--timestamp-next-update)
-(defvar mastodon-tl--timestamp-update-timer nil
+(defvar-local mastodon-tl--timestamp-update-timer nil
"The timer that, when set will scan the buffer to update the timestamps.")
-(make-variable-buffer-local 'mastodon-tl--timestamp-update-timer)
(defvar mastodon-tl--link-keymap
(let ((map (make-sparse-keymap)))
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index deea2ef..07b52e3 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -106,35 +106,28 @@ This is only used if company mode is installed."
(const :tag "following only" "following")
(const :tag "all users" "all")))
-(defvar mastodon-toot--content-warning nil
+(defvar-local mastodon-toot--content-warning nil
"A flag whether the toot should be marked with a content warning.")
-(make-variable-buffer-local 'mastodon-toot--content-warning)
-(defvar mastodon-toot--content-warning-from-reply-or-redraft nil
+(defvar-local mastodon-toot--content-warning-from-reply-or-redraft nil
"The content warning of the toot being replied to.")
-(make-variable-buffer-local 'mastodon-toot--content-warning)
-(defvar mastodon-toot--content-nsfw nil
+(defvar-local mastodon-toot--content-nsfw nil
"A flag indicating whether the toot should be marked as NSFW.")
-(make-variable-buffer-local 'mastodon-toot--content-nsfw)
-(defvar mastodon-toot--visibility "public"
+(defvar-local mastodon-toot--visibility "public"
"A string indicating the visibility of the toot being composed.
Valid values are \"direct\", \"private\" (followers-only), \"unlisted\", and \"public\".")
-(make-variable-buffer-local 'mastodon-toot--visibility)
-(defvar mastodon-toot--media-attachments nil
+(defvar-local mastodon-toot--media-attachments nil
"A list of the media attachments of the toot being composed.")
-(make-variable-buffer-local 'mastodon-toot--media-attachments)
-(defvar mastodon-toot--media-attachment-ids nil
+(defvar-local mastodon-toot--media-attachment-ids nil
"A list of any media attachment ids of the toot being composed.")
-(make-variable-buffer-local 'mastodon-toot--media-attachment-ids)
-(defvar mastodon-toot--reply-to-id nil
+(defvar-local mastodon-toot--reply-to-id nil
"Buffer-local variable to hold the id of the toot being replied to.")
-(make-variable-buffer-local 'mastodon-toot--reply-to-id)
(defvar mastodon-toot--max-toot-chars nil
"The maximum allowed characters count for a single toot.")
@@ -714,9 +707,8 @@ e.g. mastodon-toot--send -> Send."
"Format a list of keybindings, KBINDS, for display in documentation."
(mapcar #'mastodon-toot--format-kbind kbinds))
-(defvar mastodon-toot--kbinds-pairs nil
+(defvar-local mastodon-toot--kbinds-pairs nil
"Contains a list of paired toot compose buffer keybindings for inserting.")
-(make-variable-buffer-local 'mastodon-toot--kbinds-pairs)
(defun mastodon-toot--formatted-kbinds-pairs (kbinds-list longest)
"Return a list of strings each containing two formatted kbinds.