Function: quickurl-add-url

quickurl-add-url is an interactive and byte-compiled function defined in quickurl.el.gz.

Signature

(quickurl-add-url WORD URL COMMENT)

Documentation

Allow the user to interactively add a new URL associated with WORD.

See quickurl-grab-url for details on how the default word/URL combination is decided.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/quickurl.el.gz
;;;###autoload
(defun quickurl-add-url (word url comment)
  "Allow the user to interactively add a new URL associated with WORD.

See `quickurl-grab-url' for details on how the default word/URL combination
is decided."
  (interactive (let ((word-url (quickurl-grab-url)))
                 (list (read-string "Word: "    (quickurl-url-keyword word-url))
                       (read-string "URL: "     (quickurl-url-url word-url))
                       (read-string "Comment: " (quickurl-url-comment word-url)))))
  (if (zerop (length word))
      (error "You must specify a WORD for lookup")
    (quickurl-load-urls)
    (let* ((current-url (quickurl-find-url word))
           (add-it      (if current-url
                            (if (called-interactively-p 'interactive)
                                (y-or-n-p (format "\"%s\" exists, replace URL? " word))
                              t)
                          t)))
      (when add-it
        (if current-url
            (progn
              (setf (quickurl-url-url current-url) url)
              (setf (quickurl-url-comment current-url) comment))
          (push (quickurl-make-url word url comment) quickurl-urls))
        (setq quickurl-urls (funcall quickurl-sort-function quickurl-urls))
        (quickurl-save-urls)
        (when (get-buffer quickurl-list-buffer-name)
          (quickurl-list-populate-buffer))
        (when (called-interactively-p 'interactive)
          (message "Added %s" url))))))