comparison lisp/net/quickurl.el @ 49598:0d8b17d428b5

Trailing whitepace deleted.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 04 Feb 2003 13:24:35 +0000
parents b174db545cfd
children 695cf19ef79e d7ddb3e565de
comparison
equal deleted inserted replaced
49597:e88404e8f2cf 49598:0d8b17d428b5
262 Note that this function moves point to `point-min' before doing the `read' 262 Note that this function moves point to `point-min' before doing the `read'
263 It also restores point after the `read'." 263 It also restores point after the `read'."
264 (save-excursion 264 (save-excursion
265 (setf (point) (point-min)) 265 (setf (point) (point-min))
266 (setq quickurl-urls (funcall quickurl-sort-function (read buffer))))) 266 (setq quickurl-urls (funcall quickurl-sort-function (read buffer)))))
267 267
268 (defun quickurl-load-urls () 268 (defun quickurl-load-urls ()
269 "Load the contents of `quickurl-url-file' into `quickurl-urls'." 269 "Load the contents of `quickurl-url-file' into `quickurl-urls'."
270 (when (file-exists-p quickurl-url-file) 270 (when (file-exists-p quickurl-url-file)
271 (with-temp-buffer 271 (with-temp-buffer
272 (insert-file-contents quickurl-url-file) 272 (insert-file-contents quickurl-url-file)
278 (let ((standard-output (current-buffer))) 278 (let ((standard-output (current-buffer)))
279 (princ quickurl-prefix) 279 (princ quickurl-prefix)
280 (pp quickurl-urls) 280 (pp quickurl-urls)
281 (princ quickurl-postfix) 281 (princ quickurl-postfix)
282 (write-region (point-min) (point-max) quickurl-url-file nil 0)))) 282 (write-region (point-min) (point-max) quickurl-url-file nil 0))))
283 283
284 (defun quickurl-find-url (lookup) 284 (defun quickurl-find-url (lookup)
285 "Return URL associated with key LOOKUP. 285 "Return URL associated with key LOOKUP.
286 286
287 The lookup is done by looking in the alist `quickurl-urls' and the `cons' 287 The lookup is done by looking in the alist `quickurl-urls' and the `cons'
288 for the URL is returned. The actual method used to look into the alist 288 for the URL is returned. The actual method used to look into the alist
325 (let ((completion-ignore-case quickurl-completion-ignore-case)) 325 (let ((completion-ignore-case quickurl-completion-ignore-case))
326 (completing-read "Lookup: " quickurl-urls nil t))))) 326 (completing-read "Lookup: " quickurl-urls nil t)))))
327 (let ((url (quickurl-find-url lookup))) 327 (let ((url (quickurl-find-url lookup)))
328 (when url 328 (when url
329 (quickurl-insert url)))) 329 (quickurl-insert url))))
330 330
331 (defun quickurl-grab-url () 331 (defun quickurl-grab-url ()
332 "Attempt to grab a word/url pair from point in the current buffer. 332 "Attempt to grab a word/url pair from point in the current buffer.
333 333
334 Point should be somewhere on the URL and the word is taken to be the thing 334 Point should be somewhere on the URL and the word is taken to be the thing
335 that is returned from calling `quickurl-grab-lookup-function' once a 335 that is returned from calling `quickurl-grab-lookup-function' once a
368 (interactive (let ((word-url (quickurl-grab-url))) 368 (interactive (let ((word-url (quickurl-grab-url)))
369 (list (read-string "Word: " (quickurl-url-keyword word-url)) 369 (list (read-string "Word: " (quickurl-url-keyword word-url))
370 (read-string "URL: " (quickurl-url-url word-url)) 370 (read-string "URL: " (quickurl-url-url word-url))
371 (read-string "Comment: " (quickurl-url-comment word-url))))) 371 (read-string "Comment: " (quickurl-url-comment word-url)))))
372 (if (zerop (length word)) 372 (if (zerop (length word))
373 (error "You must specify a WORD for lookup") 373 (error "You must specify a WORD for lookup")
374 (quickurl-load-urls) 374 (quickurl-load-urls)
375 (let* ((current-url (quickurl-find-url word)) 375 (let* ((current-url (quickurl-find-url word))
376 (add-it (if current-url 376 (add-it (if current-url
377 (if (interactive-p) 377 (if (interactive-p)
378 (y-or-n-p (format "\"%s\" exists, replace URL? " word)) 378 (y-or-n-p (format "\"%s\" exists, replace URL? " word))
544 (quickurl-list-make-inserter url) 544 (quickurl-list-make-inserter url)
545 (quickurl-list-make-inserter naked-url) 545 (quickurl-list-make-inserter naked-url)
546 (quickurl-list-make-inserter with-lookup) 546 (quickurl-list-make-inserter with-lookup)
547 (quickurl-list-make-inserter with-desc) 547 (quickurl-list-make-inserter with-desc)
548 (quickurl-list-make-inserter lookup) 548 (quickurl-list-make-inserter lookup)
549 549
550 (provide 'quickurl) 550 (provide 'quickurl)
551 551
552 ;;; quickurl.el ends here 552 ;;; quickurl.el ends here