Convert consecutive FSF copyright years to ranges.
[bpt/emacs.git] / lisp / net / quickurl.el
index 27765ed..4045a44 100644 (file)
@@ -1,7 +1,6 @@
 ;;; 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
@@ -21,9 +20,7 @@
 ;; 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:
 ;;
@@ -175,7 +172,20 @@ in your ~/.emacs (after loading/requiring quickurl).")
 (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*"
@@ -370,7 +380,7 @@ is decided."
     (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)))
@@ -384,7 +394,7 @@ is decided."
         (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
@@ -422,21 +432,6 @@ current buffer, this default action can be modifed via
 
 ;; 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
@@ -510,9 +505,7 @@ TYPE dictates what will be inserted, options are:
   `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
@@ -546,5 +539,4 @@ TYPE dictates what will be inserted, options are:
 
 (provide 'quickurl)
 
-;;; arch-tag: a8183ea5-80c2-4082-a7d1-b0fdf2da467e
 ;;; quickurl.el ends here