Skip to content

Commit c44fe46

Browse files
committed
update docstrings
1 parent 6621d01 commit c44fe46

File tree

2 files changed

+56
-75
lines changed

2 files changed

+56
-75
lines changed

pushbullet-api.el

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,43 +41,39 @@
4141

4242
(defcustom pushbullet-api-token nil
4343
"Your personal Pushbullet API access token.
44-
This token is required for authentication with the Pushbullet API. You
45-
can obtain your access token from the Pushbullet account settings page:
44+
This token is required for authentication with the Pushbullet API.
45+
You can obtain your access token from the Pushbullet account settings page:
4646
`https://www.pushbullet.com/#settings/account`."
4747
:type 'string
4848
:group 'pushbullet-api)
4949

5050
(defcustom pushbullet-api-limit 20
51-
"The maximum number of pushes to fetch in a single API request for
52-
pagination."
51+
"The maximum number of pushes to fetch in a single API request for pagination."
5352
:type 'integer
5453
:group 'pushbullet-api)
5554

5655
(defcustom pushbullet-api-debug nil
57-
"Enable verbose logging for Pushbullet API operations.
56+
"Enable verbose logging for Pushbullet API operations.
5857
When non-nil, additional debug messages will be printed to the *Messages* buffer."
59-
:type 'boolean
60-
:group 'pushbullet-api)
58+
:type 'boolean
59+
:group 'pushbullet-api)
6160

6261
(defvar pushbullet-api-url "https://api.pushbullet.com/v2"
63-
"The base URL for all Pushbullet API v2 endpoints.")
62+
"The base URL for all Pushbullet API v2 endpoints.")
6463

6564
(defvar-local pushbullet-api-cursor nil
66-
"A buffer-local string used for pagination in Pushbullet API requests,
67-
indicating the point from which to fetch subsequent pushes.")
65+
"A buffer-local string used for pagination in Pushbullet API requests, indicating the point from which to fetch subsequent pushes.")
6866

6967
(defmacro pushbullet-api--log (fmt &rest args)
70-
"Log a debug message with FMT and ARGS when `pushbullet-debug' is
71-
enabled.
72-
The message is prefixed with '[pushbullet]' for identification."
68+
"Logs a debug message with FMT and ARGS when `pushbullet-api-debug' is enabled.
69+
The message is prefixed with '[pushbullet-api]' for identification."
7370
`(when pushbullet-api-debug
7471
(message (concat "[pushbullet-api] " ,fmt) ,@args)))
7572

7673
(defun pushbullet-api--check-token ()
77-
"Ensures that the `pushbullet-api-token' is set, either directly or by
78-
retrieving it from `auth-source'.
79-
If the token is not found, an error is signaled prompting the user to
80-
set it."
74+
"Ensures that `pushbullet-api-token' is set, either directly or by
75+
retrieving it from `auth-source'.
76+
If the token is not found, an error is signaled, prompting the user to set it."
8177
pushbullet-api-token
8278
(unless pushbullet-api-token
8379
(let ((auth-source-token (auth-source-pick-first-password :host "pushbullet.com")))
@@ -90,13 +86,12 @@ set it."
9086
"Makes an asynchronous HTTP request to the Pushbullet API.
9187
9288
METHOD is a string representing the HTTP method (e.g., 'GET', 'POST', 'DELETE').
93-
ENDPOINT is a string specifying the API endpoint relative to `pushbullet-api-url`.
89+
ENDPOINT is a string specifying the API endpoint relative to `pushbullet-api-url'.
9490
DATA is an optional alist of request data to be sent as JSON.
95-
CALLBACK is a function to be called upon successful API response, receiving the parsed JSON data.
91+
CALLBACK is a function to be called upon a successful API response, receiving the parsed JSON data.
9692
ERROR-CALLBACK is an optional function to be called if the API request encounters an error.
9793
98-
This function automatically includes the `pushbullet-api-token' for
99-
authentication and handles JSON encoding/decoding."
94+
This function automatically includes `pushbullet-api-token' for authentication and handles JSON encoding/decoding."
10095
(pushbullet-api--check-token)
10196
(let ((url (concat pushbullet-api-url endpoint))
10297
(headers `(("Access-Token" . ,pushbullet-api-token)

pushbullet.el

Lines changed: 40 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,16 @@
6464
When non-nil, additional debug messages will be printed to the
6565
*Messages* buffer."
6666
:type 'boolean
67-
:group 'pushbullet
68-
:initialize 'custom-initialize-default)
67+
:group 'pushbullet)
6968

7069
(defvar pushbullet-buffer-name "*Pushbullet*"
71-
"The name of the main buffer where the Pushbullet user interface is
72-
displayed.")
70+
"The name of the main buffer where the Pushbullet user interface is displayed.")
7371

7472
(defvar pushbullet-export-buffer-name "*Pushbullet Export*"
75-
"The name of the buffer used for exporting Pushbullet pushes to
76-
Org-mode format.")
73+
"The name of the buffer used for exporting Pushbullet pushes to Org-mode format.")
7774

7875
(defcustom pushbullet-default-title (format "GNU Emacs %s" emacs-version)
79-
"The default title string used for new pushes when no explicit title
80-
is provided.
76+
"The default title string used for new pushes when no explicit title is provided.
8177
It is formatted to include the current Emacs version."
8278
:type 'string
8379
:group 'pushbullet)
@@ -88,75 +84,68 @@ It is formatted to include the current Emacs version."
8884
:group 'pushbullet)
8985

9086
(defcustom pushbullet-left-alignment 8
91-
"The size of the left alignment padding in the Pushbullet UI."
92-
:type 'integer
93-
:group 'pushbullet)
87+
"The size of the left alignment padding in the Pushbullet UI."
88+
:type 'integer
89+
:group 'pushbullet)
9490

9591
(defcustom pushbullet-textfield-width
96-
(truncate
97-
(* (- pushbullet-columns pushbullet-left-alignment) 0.90))
98-
"The calculated width for editable text fields within the Pushbullet UI."
99-
:type 'integer
100-
:group 'pushbullet)
92+
(truncate
93+
(* (- pushbullet-columns pushbullet-left-alignment) 0.90))
94+
"The calculated width for editable text fields within the Pushbullet UI."
95+
:type 'integer
96+
:group 'pushbullet)
10197

10298
(defcustom pushbullet-show-send-form t
10399
"Whether to display the send form in the Pushbullet UI."
104100
:type 'boolean
105101
:group 'pushbullet)
106102

107103
(defvar pushbullet--buffer nil
108-
"The buffer currently used for rendering the Pushbullet UI. This is a
109-
buffer-local variable.")
104+
"The buffer currently used for rendering the Pushbullet UI. This is a buffer-local variable.")
110105

111106
(defvar pushbullet--title nil
112-
"The title string displayed at the top of the Pushbullet UI buffer.
113-
This is a buffer-local variable.")
107+
"The title string displayed at the top of the Pushbullet UI buffer. This is a buffer-local variable.")
114108

115109
(defvar pushbullet--pushes nil
116-
"A buffer-local list of Pushbullet pushes currently displayed in the
117-
UI, where each push is an alist.")
110+
"A buffer-local list of Pushbullet pushes currently displayed in the UI, where each push is an alist.")
118111

119112
(defmacro pushbullet--log (fmt &rest args)
120-
"Logs a debug message with FMT and ARGS if `pushbullet-debug' is
121-
enabled.
122-
The message is prefixed with '[pushbullet]' for easy identification
123-
in the `*Messages*' buffer."
113+
"Logs a debug message with FMT and ARGS if `pushbullet-debug' is enabled.
114+
The message is prefixed with '[pushbullet]' for easy identification in the `*Messages*' buffer."
124115
`(when pushbullet-debug
125116
(message (concat "[pushbullet] " ,fmt) ,@args)))
126117

127118
(defun pushbullet--align-right (max str)
128-
"Inserts spaces to right-align STR within a field of MAX width in the
129-
current buffer."
130-
(let ((len (length str)))
131-
(when (>= max len)
132-
(widget-insert (make-string (- max (length str)) ?\s)))))
119+
"Inserts spaces to right-align STR within a field of MAX width in the current buffer."
120+
(let ((len (length str)))
121+
(when (>= max len)
122+
(widget-insert (make-string (- max (length str)) ?\s)))))
133123

134124
(defun pushbullet--insert-aligned (str)
135-
"Inserts a newline and then the string STR, right-aligned by
136-
`pushbullet-left-alignment'."
137-
(widget-insert "\n")
138-
(pushbullet--align-right pushbullet-left-alignment str)
139-
(widget-insert str))
125+
"Inserts a newline and then the string STR, right-aligned by `pushbullet-left-alignment`."
126+
(widget-insert "\n")
127+
(pushbullet--align-right pushbullet-left-alignment str)
128+
(widget-insert str))
140129

141130
(defun pushbullet--list-filter (pushes)
142-
"Filters a list of PUSHES, returning only those that are active and
143-
have at least a title, URL, or body."
131+
"Filters a list of PUSHES, returning only those that are active and have at least a title, URL, or body."
144132
(seq-filter (lambda (push) (pushbullet-api-active push)) pushes))
145133

146134
(defun pushbullet--list-remove (pushes push)
147-
"Removes PUSH from LIST where elements in LIST match PUSH
148-
based on the `'iden' key-value pairs."
135+
"Removes PUSH from PUSHES where elements in PUSHES match PUSH based on the `'iden' key-value pairs."
149136
(let ((iden (alist-get 'iden push)))
150137
(seq-remove (lambda (item) (equal (alist-get 'iden item) iden)) pushes)))
151138

152139
(defun pushbullet--send (title body url)
140+
"Sends a push with TITLE, BODY, and URL, then reloads the UI."
153141
(pushbullet-api-send title body url)
154142
(pushbullet--log "Pushed: (%S, %S, %S)" title body url)
155143
(pushbullet--load-more 1))
156144

157145
(defun pushbullet--load-more (&optional limit)
158-
"Fetches additional pushes from the Pushbullet server using the `fetch'
159-
callback from `pushbullet--api', and then re-renders the UI."
146+
"Fetches additional pushes from the Pushbullet server using the
147+
`pushbullet-api-fetch' function, then re-renders the UI.
148+
If LIMIT is provided, fetches at most LIMIT pushes."
160149
(let ((fetch (alist-get 'fetch pushbullet--api)))
161150
(pushbullet-api-fetch
162151
#'(lambda (pushes)
@@ -175,23 +164,21 @@ in the `*Messages*' buffer."
175164
nil)
176165

177166
(defun pushbullet--export-all ()
178-
"Exports all currently loaded pushes to an Org-mode buffer using the
179-
`export' callback from `pushbullet--api'."
167+
"Exports all currently loaded pushes to an Org-mode buffer using
168+
`pushbullet-export'."
180169
(pushbullet-export pushbullet--pushes))
181170

182171
(defun pushbullet--delete-all (&rest args)
183172
"Deletes all pushes currently displayed in the UI from the Pushbullet
184-
server using the `delete' callback from `pushbullet--api', then
185-
re-renders the UI."
173+
server using `pushbullet-api-delete', then re-renders the UI."
186174
(dolist (push pushbullet--pushes)
187175
(pushbullet-api-delete push))
188176
(setq pushbullet--pushes nil)
189177
(pushbullet--render))
190178

191179
(defun pushbullet--delete-row (push)
192-
"Deletes a single PUSH from the `pushbullet--pushes' list, invokes
193-
the `delete' callback from `pushbullet--api', and then re-renders
194-
the UI."
180+
"Deletes a single PUSH from `pushbullet--pushes', invokes
181+
`pushbullet-api-delete', and then re-renders the UI."
195182
(setq pushbullet--pushes
196183
(pushbullet--list-remove pushbullet--pushes push))
197184
(pushbullet-api-delete push)
@@ -255,16 +242,15 @@ title, URL, and body, and 'Delete' buttons."
255242
(widget-insert "\n")))
256243

257244
(defun pushbullet--render-pushes ()
258-
"Render the list of pushes in the UI (`pushbullet-ai--pushes')."
245+
"Renders the list of pushes in the UI (`pushbullet--pushes')."
259246
(dolist (push pushbullet--pushes)
260247
(when (pushbullet-api-active push)
261248
(pushbullet--render-push push))))
262249

263250
(defun pushbullet--render-form ()
264251
"Renders the 'New Push' form, allowing users to input a title, URL,
265252
and body for a new Pushbullet push.
266-
Includes a 'Push' button to submit the form via the `send' callback from
267-
`pushbullet--api'."
253+
Includes a 'Push' button to submit the form via `pushbullet--send'."
268254
(widget-insert
269255
(propertize
270256
(concat "\n\n\n══ New Push "
@@ -357,12 +343,12 @@ Each active push is formatted as an Org-mode heading, including its
357343
title, URL (if present), and body.
358344
359345
If PUSHES is `nil` or the function is called interactively, it exports
360-
the currently displayed pushes from the UI (`pushbullet-ui--pushes`).
346+
the currently displayed pushes from the UI (`pushbullet--pushes').
361347
362348
This function is interactive."
363349
(interactive)
364350
(let ((buffer (get-buffer-create pushbullet-export-buffer-name))
365-
(pushes (or pushes pushbullet-ui--pushes)))
351+
(pushes (or pushes pushbullet--pushes)))
366352
(with-current-buffer buffer
367353
(remove-overlays)
368354
(erase-buffer)

0 commit comments

Comments
 (0)