6464When 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.
8177It 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
357343title, URL (if present), and body.
358344
359345If 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
362348This 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