;;; quickurl.el --- insert an URL based on text at point in buffer
-;; Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006 Free Software Foundation, Inc.
;; Author: Dave Pearson <davep@davep.org>
;; Maintainer: Dave Pearson <davep@davep.org>
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
;;
;; Main code:
-(defun* quickurl-read (&optional (buffer (current-buffer)))
+(defun* quickurl-read (&optional buffer)
"`read' the URL list from BUFFER into `quickurl-urls'.
+BUFFER, if nil, defaults to current buffer.
Note that this function moves point to `point-min' before doing the `read'
It also restores point after the `read'."
(save-excursion
(setf (point) (point-min))
- (setq quickurl-urls (funcall quickurl-sort-function (read buffer)))))
+ (setq quickurl-urls (funcall quickurl-sort-function
+ (read (or buffer (current-buffer)))))))
(defun quickurl-load-urls ()
"Load the contents of `quickurl-url-file' into `quickurl-urls'."
(message "Found %s" (quickurl-url-url url))))
;;;###autoload
-(defun* quickurl (&optional (lookup (funcall quickurl-grab-lookup-function)))
+(defun* quickurl (&optional lookup)
"Insert an URL based on LOOKUP.
If not supplied LOOKUP is taken to be the word at point in the current
buffer, this default action can be modifed via
`quickurl-grab-lookup-function'."
(interactive)
- (when lookup
+ (when (or lookup
+ (setq lookup (funcall quickurl-grab-lookup-function)))
(quickurl-load-urls)
(let ((url (quickurl-find-url lookup)))
(if (null url)
(message "Added %s" url))))))
;;;###autoload
-(defun* quickurl-browse-url (&optional (lookup (funcall quickurl-grab-lookup-function)))
+(defun quickurl-browse-url (&optional lookup)
"Browse the URL associated with LOOKUP.
If not supplied LOOKUP is taken to be the word at point in the
current buffer, this default action can be modifed via
`quickurl-grab-lookup-function'."
(interactive)
- (when lookup
+ (when (or lookup
+ (setq lookup (funcall quickurl-grab-lookup-function)))
(quickurl-load-urls)
(let ((url (quickurl-find-url lookup)))
(if url
(use-local-map quickurl-list-mode-map)
(setq major-mode 'quickurl-list-mode
mode-name "quickurl list")
- (run-hooks 'quickurl-list-mode-hook)
+ (run-mode-hooks 'quickurl-list-mode-hook)
(setq buffer-read-only t
truncate-lines t))