gnus-registry.el: Correct function argument order.
[gnus] / lisp / gnus-bookmark.el
index aa3e2d7..e26c78b 100644 (file)
@@ -1,6 +1,6 @@
 ;;; gnus-bookmark.el --- Bookmarks in Gnus
 
-;; Copyright (C) 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+;; Copyright (C) 2006-2015 Free Software Foundation, Inc.
 
 ;; Author: Bastien Guerry <bzg AT altern DOT org>
 ;; Keywords: news
@@ -156,9 +156,6 @@ The default value is \(author subject date group annotation\)."
   "The current version of the format used by bookmark files.
 You should never need to change this.")
 
-(defvar gnus-bookmark-after-jump-hook nil
-  "Hook run after `gnus-bookmark-jump' jumps to a Gnus bookmark.")
-
 (defvar gnus-bookmark-alist ()
   "Association list of Gnus bookmarks and their records.
 The format of the alist is
@@ -193,7 +190,7 @@ So the cdr of each bookmark is an alist too.")
   "Set a bookmark for this article."
   (interactive)
   (gnus-bookmark-maybe-load-default-file)
-  (if (or (not (eq major-mode 'gnus-summary-mode))
+  (if (or (not (derived-mode-p 'gnus-summary-mode))
          (not gnus-article-current))
       (error "Please select an article in the Gnus summary buffer")
     (let* ((group (car gnus-article-current))
@@ -254,7 +251,7 @@ So the cdr of each bookmark is an alist too.")
   (interactive)
   (save-excursion
     (save-window-excursion
-      ;; Avoir warnings?
+      ;; Avoid warnings?
       ;; (message "Saving Gnus bookmarks to file %s..." gnus-bookmark-default-file)
       (set-buffer (get-buffer-create  " *Gnus bookmarks*"))
       (erase-buffer)
@@ -292,8 +289,8 @@ So the cdr of each bookmark is an alist too.")
   (interactive)
   (gnus-bookmark-maybe-load-default-file)
   (let* ((bookmark (or bmk-name
-         (completing-read "Jump to bookmarked article: "
-                          gnus-bookmark-alist)))
+                       (gnus-completing-read "Jump to bookmarked article"
+                                             (mapcar 'car gnus-bookmark-alist))))
         (bmk-record (cadr (assoc bookmark gnus-bookmark-alist)))
         (group (cdr (assoc 'group bmk-record)))
         (message-id (cdr (assoc 'message-id bmk-record))))
@@ -370,7 +367,7 @@ The leftmost column displays a D if the bookmark is flagged for
 deletion, or > if it is flagged for displaying."
   (interactive)
   (gnus-bookmark-maybe-load-default-file)
-  (if (interactive-p)
+  (if (gmm-called-interactively-p 'any)
       (switch-to-buffer (get-buffer-create "*Gnus Bookmark List*"))
     (set-buffer (get-buffer-create "*Gnus Bookmark List*")))
   (let ((inhibit-read-only t)
@@ -476,7 +473,7 @@ That is, all information but the name."
 ;; Been to lazy to use gnus-bookmark-save...
 (defalias 'gnus-bookmark-bmenu-save 'gnus-bookmark-write-file)
 
-(defun gnus-bookmark-bmenu-mode ()
+(define-derived-mode gnus-bookmark-bmenu-mode fundamental-mode "Bookmark Menu"
   "Major mode for editing a list of Gnus bookmarks.
 Each line describes one of the bookmarks in Gnus.
 Letters do not insert themselves; instead, they are commands.
@@ -500,13 +497,8 @@ Gnus bookmarks names preceded by a \"*\" have annotations.
   in another buffer.
 \\[gnus-bookmark-bmenu-show-all-annotations] -- show the annotations of all bookmarks in another buffer.
 \\[gnus-bookmark-bmenu-edit-annotation] -- edit the annotation for the current bookmark."
-  (kill-all-local-variables)
-  (use-local-map gnus-bookmark-bmenu-mode-map)
   (setq truncate-lines t)
-  (setq buffer-read-only t)
-  (setq major-mode 'gnus-bookmark-bmenu-mode)
-  (setq mode-name "Bookmark Menu")
-  (gnus-run-mode-hooks 'gnus-bookmark-bmenu-mode-hook))
+  (setq buffer-read-only t))
 
 ;; avoid compilation warnings
 (defvar gnus-bookmark-bmenu-toggle-infos nil)
@@ -541,7 +533,7 @@ Optional argument SHOW means show them unconditionally."
             (let ((bmrk (gnus-bookmark-bmenu-bookmark)))
               (setq gnus-bookmark-bmenu-hidden-bookmarks
                     (cons bmrk gnus-bookmark-bmenu-hidden-bookmarks))
-             (let ((start (save-excursion (end-of-line) (point))))
+             (let ((start (point-at-eol)))
                (move-to-column gnus-bookmark-bmenu-file-column t)
                ;; Strip off `mouse-face' from the white spaces region.
                (if (gnus-bookmark-mouse-available-p)
@@ -575,10 +567,9 @@ Optional argument SHOW means show them unconditionally."
   "Kill from point to end of line.
 If optional arg NEWLINE-TOO is non-nil, delete the newline too.
 Does not affect the kill ring."
-  (let ((eol (save-excursion (end-of-line) (point))))
-    (delete-region (point) eol)
-    (if (and newline-too (looking-at "\n"))
-        (delete-char 1))))
+  (delete-region (point) (point-at-eol))
+  (if (and newline-too (looking-at "\n"))
+      (delete-char 1)))
 
 (defun gnus-bookmark-get-details (bmk-name details-list)
   "Get details for a Gnus BMK-NAME depending on DETAILS-LIST."