;;; quickurl.el --- insert an URL based on text at point in buffer
-;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2011 Free Software Foundation, Inc.
;; Author: Dave Pearson <davep@davep.org>
;; Maintainer: Dave Pearson <davep@davep.org>
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; 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., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
(defvar quickurl-urls nil
"URL alist for use with `quickurl' and `quickurl-ask'.")
-(defvar quickurl-list-mode-map nil
+(defvar quickurl-list-mode-map
+ (let ((map (make-sparse-keymap)))
+ (suppress-keymap map t)
+ (define-key map "a" #'quickurl-list-add-url)
+ (define-key map [(control m)] #'quickurl-list-insert-url)
+ (define-key map "u" #'quickurl-list-insert-naked-url)
+ (define-key map " " #'quickurl-list-insert-with-lookup)
+ (define-key map "l" #'quickurl-list-insert-lookup)
+ (define-key map "d" #'quickurl-list-insert-with-desc)
+ (define-key map [(control g)] #'quickurl-list-quit)
+ (define-key map "q" #'quickurl-list-quit)
+ (define-key map [mouse-2] #'quickurl-list-mouse-select)
+ (define-key map "?" #'describe-mode)
+ map)
"Local keymap for a `quickurl-list-mode' buffer.")
(defvar quickurl-list-buffer-name "*quickurl-list*"
(quickurl-load-urls)
(let* ((current-url (quickurl-find-url word))
(add-it (if current-url
- (if (interactive-p)
+ (if (called-interactively-p 'interactive)
(y-or-n-p (format "\"%s\" exists, replace URL? " word))
t)
t)))
(quickurl-save-urls)
(when (get-buffer quickurl-list-buffer-name)
(quickurl-list-populate-buffer))
- (when (interactive-p)
+ (when (called-interactively-p 'interactive)
(message "Added %s" url))))))
;;;###autoload
;; quickurl-list mode.
-(unless quickurl-list-mode-map
- (let ((map (make-sparse-keymap)))
- (suppress-keymap map t)
- (define-key map "a" #'quickurl-list-add-url)
- (define-key map [(control m)] #'quickurl-list-insert-url)
- (define-key map "u" #'quickurl-list-insert-naked-url)
- (define-key map " " #'quickurl-list-insert-with-lookup)
- (define-key map "l" #'quickurl-list-insert-lookup)
- (define-key map "d" #'quickurl-list-insert-with-desc)
- (define-key map [(control g)] #'quickurl-list-quit)
- (define-key map "q" #'quickurl-list-quit)
- (define-key map [mouse-2] #'quickurl-list-mouse-select)
- (define-key map "?" #'describe-mode)
- (setq quickurl-list-mode-map map)))
-
(put 'quickurl-list-mode 'mode-class 'special)
;;;###autoload
`with-lookup' - Insert \"lookup <URL:url>\"
`with-desc' - Insert \"description <URL:url>\"
`lookup' - Insert the lookup for that URL"
- (let ((url (nth (save-excursion
- (beginning-of-line)
- (count-lines (point-min) (point)))
+ (let ((url (nth (count-lines (point-min) (line-beginning-position))
quickurl-urls)))
(if url
(with-current-buffer quickurl-list-last-buffer
(provide 'quickurl)
-;;; arch-tag: a8183ea5-80c2-4082-a7d1-b0fdf2da467e
;;; quickurl.el ends here