Mercurial > emacs
comparison lisp/net/quickurl.el @ 55459:4a7badfefc94
(quickurl, quickurl-browse-url, quickurl-read):
Don't use CL-style default args.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Sun, 09 May 2004 01:54:36 +0000 |
parents | 695cf19ef79e |
children | df55e63482c4 4c90ffeb71c5 |
comparison
equal
deleted
inserted
replaced
55458:f673d8bf105a | 55459:4a7badfefc94 |
---|---|
254 (quickurl-url-keyword url) | 254 (quickurl-url-keyword url) |
255 desc))) | 255 desc))) |
256 | 256 |
257 ;; Main code: | 257 ;; Main code: |
258 | 258 |
259 (defun* quickurl-read (&optional (buffer (current-buffer))) | 259 (defun* quickurl-read (&optional buffer) |
260 "`read' the URL list from BUFFER into `quickurl-urls'. | 260 "`read' the URL list from BUFFER into `quickurl-urls'. |
261 | 261 |
262 BUFFER, if nil, defaults to current buffer. | |
262 Note that this function moves point to `point-min' before doing the `read' | 263 Note that this function moves point to `point-min' before doing the `read' |
263 It also restores point after the `read'." | 264 It also restores point after the `read'." |
264 (save-excursion | 265 (save-excursion |
265 (setf (point) (point-min)) | 266 (setf (point) (point-min)) |
266 (setq quickurl-urls (funcall quickurl-sort-function (read buffer))))) | 267 (setq quickurl-urls (funcall quickurl-sort-function |
268 (read (or buffer (current-buffer))))))) | |
267 | 269 |
268 (defun quickurl-load-urls () | 270 (defun quickurl-load-urls () |
269 "Load the contents of `quickurl-url-file' into `quickurl-urls'." | 271 "Load the contents of `quickurl-url-file' into `quickurl-urls'." |
270 (when (file-exists-p quickurl-url-file) | 272 (when (file-exists-p quickurl-url-file) |
271 (with-temp-buffer | 273 (with-temp-buffer |
296 (insert (funcall quickurl-format-function url)) | 298 (insert (funcall quickurl-format-function url)) |
297 (unless silent | 299 (unless silent |
298 (message "Found %s" (quickurl-url-url url)))) | 300 (message "Found %s" (quickurl-url-url url)))) |
299 | 301 |
300 ;;;###autoload | 302 ;;;###autoload |
301 (defun* quickurl (&optional (lookup (funcall quickurl-grab-lookup-function))) | 303 (defun* quickurl (&optional lookup) |
302 "Insert an URL based on LOOKUP. | 304 "Insert an URL based on LOOKUP. |
303 | 305 |
304 If not supplied LOOKUP is taken to be the word at point in the current | 306 If not supplied LOOKUP is taken to be the word at point in the current |
305 buffer, this default action can be modifed via | 307 buffer, this default action can be modifed via |
306 `quickurl-grab-lookup-function'." | 308 `quickurl-grab-lookup-function'." |
307 (interactive) | 309 (interactive) |
308 (when lookup | 310 (when (or lookup |
311 (setq lookup (funcall quickurl-grab-lookup-function))) | |
309 (quickurl-load-urls) | 312 (quickurl-load-urls) |
310 (let ((url (quickurl-find-url lookup))) | 313 (let ((url (quickurl-find-url lookup))) |
311 (if (null url) | 314 (if (null url) |
312 (error "No URL associated with \"%s\"" lookup) | 315 (error "No URL associated with \"%s\"" lookup) |
313 (when (looking-at "\\w") | 316 (when (looking-at "\\w") |
390 (quickurl-list-populate-buffer)) | 393 (quickurl-list-populate-buffer)) |
391 (when (interactive-p) | 394 (when (interactive-p) |
392 (message "Added %s" url)))))) | 395 (message "Added %s" url)))))) |
393 | 396 |
394 ;;;###autoload | 397 ;;;###autoload |
395 (defun* quickurl-browse-url (&optional (lookup (funcall quickurl-grab-lookup-function))) | 398 (defun quickurl-browse-url (&optional lookup) |
396 "Browse the URL associated with LOOKUP. | 399 "Browse the URL associated with LOOKUP. |
397 | 400 |
398 If not supplied LOOKUP is taken to be the word at point in the | 401 If not supplied LOOKUP is taken to be the word at point in the |
399 current buffer, this default action can be modifed via | 402 current buffer, this default action can be modifed via |
400 `quickurl-grab-lookup-function'." | 403 `quickurl-grab-lookup-function'." |
401 (interactive) | 404 (interactive) |
402 (when lookup | 405 (when (or lookup |
406 (setq lookup (funcall quickurl-grab-lookup-function))) | |
403 (quickurl-load-urls) | 407 (quickurl-load-urls) |
404 (let ((url (quickurl-find-url lookup))) | 408 (let ((url (quickurl-find-url lookup))) |
405 (if url | 409 (if url |
406 (browse-url (quickurl-url-url url)) | 410 (browse-url (quickurl-url-url url)) |
407 (error "No URL associated with \"%s\"" lookup))))) | 411 (error "No URL associated with \"%s\"" lookup))))) |