Commit abef340a authored by Sam Steingold's avatar Sam Steingold

* lisp/simple.el (special-mode-map): Bind "h" to `describe-mode';

bind "z" to `kill-this-buffer'.
(completion-list-mode-map): Bind "z" to `kill-this-buffer'.
* lisp/apropos.el (apropos-mode-map): Inherit from `special-mode-map'.
(apropos-mode): Inherit from `special-mode'.
* lisp/arc-mode.el (archive-mode-map): Inherit from `special-mode-map'.
* lisp/bookmark.el (bookmark-bmenu-mode): Define using
`define-derived-mode' inheriting from `special-mode'.
* lisp/dired.el (dired-mode-map): Inherit from `special-mode-map'.
* lisp/image-mode.el (image-mode-map): Ditto.
* lisp/replace.el (occur-mode): Define using
`define-derived-mode' inheriting from `special-mode'.
* lisp/tar-mode.el (tar-mode): Inherit from `special-mode'.
* lisp/calendar/diary-lib.el (diary-fancy-display-mode):
Inherit from `special-mode-map'.
* lisp/emacs-lisp/ert.el (ert-simple-view-mode, ert-results-mode):
Inherit from `special-mode'.
* lisp/emacs-lisp/package.el (package-menu-mode-map): Copy from
`special-mode-map'.
(package-menu-mode): Define using `define-derived-mode'
inheriting from `special-mode'.
* erc/erc-list.el (erc-list-menu-mode): Inherit from `special-mode'.
* lisp/net/xesam.el (xesam-mode): Inherit from `special-mode'.
(xesam-mode-map): Define separately.
* lisp/play/solitaire.el (solitaire-mode): Inherit from `special-mode'.
* lisp/progmodes/compile.el (compilation-minor-mode-map)
(compilation-mode-map): Inherit from `special-mode-map'.
* lisp/vc/diff-mode.el (diff-mode-shared-map):
Inherit from `special-mode-map'.
* lisp/vc/log-view.el (log-view-mode-map): Add a comment.
parent 3082f617
2011-02-01 Sam Steingold <sds@gnu.org>
* simple.el (special-mode-map): Bind "h" to `describe-mode';
bind "z" to `kill-this-buffer'.
(completion-list-mode-map): Bind "z" to `kill-this-buffer'.
* apropos.el (apropos-mode-map): Inherit from `special-mode-map'.
(apropos-mode): Inherit from `special-mode'.
* arc-mode.el (archive-mode-map): Inherit from `special-mode-map'.
* bookmark.el (bookmark-bmenu-mode): Define using
`define-derived-mode' inheriting from `special-mode'.
* dired.el (dired-mode-map): Inherit from `special-mode-map'.
* image-mode.el (image-mode-map): Ditto.
* replace.el (occur-mode): Define using
`define-derived-mode' inheriting from `special-mode'.
* tar-mode.el (tar-mode): Inherit from `special-mode'.
* calendar/diary-lib.el (diary-fancy-display-mode):
Inherit from `special-mode-map'.
* emacs-lisp/ert.el (ert-simple-view-mode, ert-results-mode):
Inherit from `special-mode'.
* emacs-lisp/package.el (package-menu-mode-map): Copy from
`special-mode-map'.
(package-menu-mode): Define using `define-derived-mode'
inheriting from `special-mode'.
* erc/erc-list.el (erc-list-menu-mode): Inherit from `special-mode'.
* net/xesam.el (xesam-mode): Inherit from `special-mode'.
(xesam-mode-map): Define separately.
* play/solitaire.el (solitaire-mode): Inherit from `special-mode'.
* progmodes/compile.el (compilation-minor-mode-map)
(compilation-mode-map): Inherit from `special-mode-map'.
* vc/diff-mode.el (diff-mode-shared-map):
Inherit from `special-mode-map'.
* vc/log-view.el (log-view-mode-map): Add a comment.
2011-02-01 Sam Steingold <sds@gnu.org>
* subr.el (purecopy-cons, purecopy-car): Add shortcuts.
......
......@@ -121,15 +121,12 @@ If value is `verbose', the computed score is shown for each match."
(const :tag "show scores" verbose)))
(defvar apropos-mode-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map button-buffer-map)
(let ((map (copy-keymap button-buffer-map)))
(set-keymap-parent map special-mode-map)
;; Use `apropos-follow' instead of just using the button
;; definition of RET, so that users can use it anywhere in an
;; apropos item, not just on top of a button.
(define-key map "\C-m" 'apropos-follow)
(define-key map " " 'scroll-up)
(define-key map "\177" 'scroll-down)
(define-key map "q" 'quit-window)
map)
"Keymap used in Apropos mode.")
......@@ -410,7 +407,7 @@ This requires that at least 2 keywords (unless only one was given)."
"Return t if DOC is really matched by the current keywords."
(apropos-true-hit doc apropos-all-words))
(define-derived-mode apropos-mode fundamental-mode "Apropos"
(define-derived-mode apropos-mode special-mode "Apropos"
"Major mode for following hyperlinks in output of apropos commands.
\\{apropos-mode-map}")
......
......@@ -339,7 +339,7 @@ be added."
(defvar archive-local-name nil "Name of local copy of remote archive.")
(defvar archive-mode-map
(let ((map (make-keymap)))
(suppress-keymap map)
(set-keymap-parent map 'special-mode-map)
(define-key map " " 'archive-next-line)
(define-key map "a" 'archive-alternate-display)
;;(define-key map "c" 'archive-copy)
......@@ -348,15 +348,12 @@ be added."
(define-key map "e" 'archive-extract)
(define-key map "f" 'archive-extract)
(define-key map "\C-m" 'archive-extract)
(define-key map "g" 'revert-buffer)
(define-key map "h" 'describe-mode)
(define-key map "m" 'archive-mark)
(define-key map "n" 'archive-next-line)
(define-key map "\C-n" 'archive-next-line)
(define-key map [down] 'archive-next-line)
(define-key map "o" 'archive-extract-other-window)
(define-key map "p" 'archive-previous-line)
(define-key map "q" 'quit-window)
(define-key map "\C-p" 'archive-previous-line)
(define-key map [up] 'archive-previous-line)
(define-key map "r" 'archive-rename-entry)
......
......@@ -1058,7 +1058,7 @@ compatibility only."
(defun bookmark-handle-bookmark (bookmark-name-or-record)
"Call BOOKMARK-NAME-OR-RECORD's handler or `bookmark-default-handler'
if it has none. This changes current buffer and point and returns nil,
or signals a `file-error'.
or signals a `file-error'.
If BOOKMARK-NAME-OR-RECORD has no file, this is a no-op. If
BOOKMARK-NAME-OR-RECORD has a file, but that file no longer exists,
......@@ -1473,45 +1473,6 @@ method buffers use to resolve name collisions."
(defvar bookmark-bmenu-hidden-bookmarks ())
(defvar bookmark-bmenu-mode-map
(let ((map (make-keymap)))
(suppress-keymap map t)
(define-key map "q" 'quit-window)
(define-key map "v" 'bookmark-bmenu-select)
(define-key map "w" 'bookmark-bmenu-locate)
(define-key map "2" 'bookmark-bmenu-2-window)
(define-key map "1" 'bookmark-bmenu-1-window)
(define-key map "j" 'bookmark-bmenu-this-window)
(define-key map "\C-c\C-c" 'bookmark-bmenu-this-window)
(define-key map "f" 'bookmark-bmenu-this-window)
(define-key map "\C-m" 'bookmark-bmenu-this-window)
(define-key map "o" 'bookmark-bmenu-other-window)
(define-key map "\C-o" 'bookmark-bmenu-switch-other-window)
(define-key map "s" 'bookmark-bmenu-save)
(define-key map "k" 'bookmark-bmenu-delete)
(define-key map "\C-d" 'bookmark-bmenu-delete-backwards)
(define-key map "x" 'bookmark-bmenu-execute-deletions)
(define-key map "d" 'bookmark-bmenu-delete)
(define-key map " " 'next-line)
(define-key map "n" 'next-line)
(define-key map "p" 'previous-line)
(define-key map "\177" 'bookmark-bmenu-backup-unmark)
(define-key map "?" 'describe-mode)
(define-key map "u" 'bookmark-bmenu-unmark)
(define-key map "m" 'bookmark-bmenu-mark)
(define-key map "l" 'bookmark-bmenu-load)
(define-key map "r" 'bookmark-bmenu-rename)
(define-key map "R" 'bookmark-bmenu-relocate)
(define-key map "t" 'bookmark-bmenu-toggle-filenames)
(define-key map "a" 'bookmark-bmenu-show-annotation)
(define-key map "A" 'bookmark-bmenu-show-all-annotations)
(define-key map "e" 'bookmark-bmenu-edit-annotation)
;; The original binding of M-g hides the M-g prefix map.
;; If someone has a better idea than M-g s, I'm open to suggestions.
(define-key map [?\M-g ?s] 'bookmark-bmenu-search)
(define-key map [mouse-2] 'bookmark-bmenu-other-window-with-mouse)
map))
;; Bookmark Buffer Menu mode is suitable only for specially formatted
;; data.
(put 'bookmark-bmenu-mode 'mode-class 'special)
......@@ -1586,7 +1547,7 @@ deletion, or > if it is flagged for displaying."
(defun bookmark-bmenu-mode ()
(define-derived-mode bookmark-bmenu-mode special-mode "Bookmark Menu"
"Major mode for editing a list of bookmarks.
Each line describes one of the bookmarks in Emacs.
Letters do not insert themselves; instead, they are commands.
......@@ -1619,14 +1580,42 @@ Bookmark names preceded by a \"*\" have annotations.
in another buffer.
\\[bookmark-bmenu-show-all-annotations] -- show the annotations of all bookmarks in another buffer.
\\[bookmark-bmenu-edit-annotation] -- edit the annotation for the current bookmark."
(kill-all-local-variables)
(use-local-map bookmark-bmenu-mode-map)
(setq truncate-lines t)
(setq buffer-read-only t)
(setq major-mode 'bookmark-bmenu-mode)
(setq mode-name "Bookmark Menu")
(run-mode-hooks 'bookmark-bmenu-mode-hook))
(setq buffer-read-only t))
(define-key bookmark-bmenu-mode-map "q" 'quit-window)
(define-key bookmark-bmenu-mode-map "v" 'bookmark-bmenu-select)
(define-key bookmark-bmenu-mode-map "w" 'bookmark-bmenu-locate)
(define-key bookmark-bmenu-mode-map "2" 'bookmark-bmenu-2-window)
(define-key bookmark-bmenu-mode-map "1" 'bookmark-bmenu-1-window)
(define-key bookmark-bmenu-mode-map "j" 'bookmark-bmenu-this-window)
(define-key bookmark-bmenu-mode-map "\C-c\C-c" 'bookmark-bmenu-this-window)
(define-key bookmark-bmenu-mode-map "f" 'bookmark-bmenu-this-window)
(define-key bookmark-bmenu-mode-map "\C-m" 'bookmark-bmenu-this-window)
(define-key bookmark-bmenu-mode-map "o" 'bookmark-bmenu-other-window)
(define-key bookmark-bmenu-mode-map "\C-o" 'bookmark-bmenu-switch-other-window)
(define-key bookmark-bmenu-mode-map "s" 'bookmark-bmenu-save)
(define-key bookmark-bmenu-mode-map "k" 'bookmark-bmenu-delete)
(define-key bookmark-bmenu-mode-map "\C-d" 'bookmark-bmenu-delete-backwards)
(define-key bookmark-bmenu-mode-map "x" 'bookmark-bmenu-execute-deletions)
(define-key bookmark-bmenu-mode-map "d" 'bookmark-bmenu-delete)
(define-key bookmark-bmenu-mode-map " " 'next-line)
(define-key bookmark-bmenu-mode-map "n" 'next-line)
(define-key bookmark-bmenu-mode-map "p" 'previous-line)
(define-key bookmark-bmenu-mode-map "\177" 'bookmark-bmenu-backup-unmark)
(define-key bookmark-bmenu-mode-map "?" 'describe-mode)
(define-key bookmark-bmenu-mode-map "u" 'bookmark-bmenu-unmark)
(define-key bookmark-bmenu-mode-map "m" 'bookmark-bmenu-mark)
(define-key bookmark-bmenu-mode-map "l" 'bookmark-bmenu-load)
(define-key bookmark-bmenu-mode-map "r" 'bookmark-bmenu-rename)
(define-key bookmark-bmenu-mode-map "R" 'bookmark-bmenu-relocate)
(define-key bookmark-bmenu-mode-map "t" 'bookmark-bmenu-toggle-filenames)
(define-key bookmark-bmenu-mode-map "a" 'bookmark-bmenu-show-annotation)
(define-key bookmark-bmenu-mode-map "A" 'bookmark-bmenu-show-all-annotations)
(define-key bookmark-bmenu-mode-map "e" 'bookmark-bmenu-edit-annotation)
;; The original binding of M-g hides the M-g prefix map.
;; If someone has a better idea than M-g s, I'm open to suggestions.
(define-key bookmark-bmenu-mode-map [?\M-g ?s] 'bookmark-bmenu-search)(define-key bookmark-bmenu-mode-map [mouse-2] 'bookmark-bmenu-other-window-with-mouse)
(defun bookmark-bmenu-toggle-filenames (&optional show)
"Toggle whether filenames are shown in the bookmark list.
......
......@@ -2409,12 +2409,10 @@ Fontify the region between BEG and END, quietly unless VERBOSE is non-nil."
(setq end (line-beginning-position 2)))
(font-lock-default-fontify-region beg end verbose))
(defvar diary-fancy-overriding-map (let ((map (make-sparse-keymap)))
(define-key map "q" 'quit-window)
map)
(defvar diary-fancy-overriding-map (make-sparse-keymap)
"Keymap overriding minor-mode maps in `diary-fancy-display-mode'.")
(define-derived-mode diary-fancy-display-mode fundamental-mode
(define-derived-mode diary-fancy-display-mode special-mode
"Diary"
"Major mode used while displaying diary entries using Fancy Display."
(set (make-local-variable 'font-lock-defaults)
......@@ -2422,7 +2420,6 @@ Fontify the region between BEG and END, quietly unless VERBOSE is non-nil."
t nil nil nil
(font-lock-fontify-region-function
. diary-fancy-font-lock-fontify-region-function)))
(local-set-key "q" 'quit-window)
(set (make-local-variable 'minor-mode-overriding-map-alist)
(list (cons t diary-fancy-overriding-map)))
(view-mode 1))
......
......@@ -1294,7 +1294,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
;; This looks ugly when substitute-command-keys uses C-d instead d:
;; (define-key dired-mode-map "\C-d" 'dired-flag-file-deletion)
(let ((map (make-keymap)))
(suppress-keymap map)
(set-keymap-parent map special-mode-map)
(define-key map [mouse-2] 'dired-mouse-find-file-other-window)
(define-key map [follow-link] 'mouse-face)
;; Commands to mark or flag certain categories of files
......@@ -1373,7 +1373,6 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
(define-key map "\C-m" 'dired-find-file)
(put 'dired-find-file :advertised-binding "\C-m")
(define-key map "g" 'revert-buffer)
(define-key map "h" 'describe-mode)
(define-key map "i" 'dired-maybe-insert-subdir)
(define-key map "j" 'dired-goto-file)
(define-key map "k" 'dired-do-kill-lines)
......@@ -1383,7 +1382,6 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
(define-key map "o" 'dired-find-file-other-window)
(define-key map "\C-o" 'dired-display-file)
(define-key map "p" 'dired-previous-line)
(define-key map "q" 'quit-window)
(define-key map "s" 'dired-sort-toggle-or-edit)
(define-key map "t" 'dired-toggle-marks)
(define-key map "u" 'dired-unmark)
......@@ -2027,7 +2025,7 @@ Otherwise, an error occurs in these cases."
;; with quotation marks in their names.
(while (string-match "\\(?:[^\\]\\|\\`\\)\\(\"\\)" file)
(setq file (replace-match "\\\"" nil t file 1)))
(when (eq system-type 'windows-nt)
(save-match-data
(let ((start 0))
......
......@@ -1997,19 +1997,12 @@ and how to display message."
;;; Simple view mode for auxiliary information like stack traces or
;;; messages. Mainly binds "q" for quit.
(define-derived-mode ert-simple-view-mode fundamental-mode "ERT-View"
(define-derived-mode ert-simple-view-mode special-mode "ERT-View"
"Major mode for viewing auxiliary information in ERT.")
(loop for (key binding) in
'(("q" quit-window)
)
do
(define-key ert-simple-view-mode-map key binding))
;;; Commands and button actions for the results buffer.
(define-derived-mode ert-results-mode fundamental-mode "ERT-Results"
(define-derived-mode ert-results-mode special-mode "ERT-Results"
"Major mode for viewing results of ERT test runs.")
(loop for (key binding) in
......@@ -2017,7 +2010,6 @@ and how to display message."
("\t" forward-button)
([backtab] backward-button)
("j" ert-results-jump-between-summary-and-result)
("q" quit-window)
("L" ert-results-toggle-printer-limits-for-test-at-point)
("n" ert-results-next-test)
("p" ert-results-previous-test)
......
......@@ -1213,18 +1213,16 @@ If optional arg NO-ACTIVATE is non-nil, don't activate packages."
;;;; Package menu mode.
(defvar package-menu-mode-map
(let ((map (make-keymap))
(let ((map (copy-keymap special-mode-map))
(menu-map (make-sparse-keymap "Package")))
(set-keymap-parent map button-buffer-map)
(define-key map "\C-m" 'package-menu-describe-package)
(define-key map "q" 'quit-window)
(define-key map "n" 'next-line)
(define-key map "p" 'previous-line)
(define-key map "u" 'package-menu-mark-unmark)
(define-key map "\177" 'package-menu-backup-unmark)
(define-key map "d" 'package-menu-mark-delete)
(define-key map "i" 'package-menu-mark-install)
(define-key map "g" 'revert-buffer)
(define-key map "r" 'package-menu-refresh)
(define-key map "~" 'package-menu-mark-obsolete-for-deletion)
(define-key map "x" 'package-menu-execute)
......@@ -1290,15 +1288,11 @@ If optional arg NO-ACTIVATE is non-nil, don't activate packages."
(put 'package-menu-mode 'mode-class 'special)
(defun package-menu-mode ()
(define-derived-mode package-menu-mode special-mode "Package Menu"
"Major mode for browsing a list of packages.
Letters do not insert themselves; instead, they are commands.
\\<package-menu-mode-map>
\\{package-menu-mode-map}"
(kill-all-local-variables)
(use-local-map package-menu-mode-map)
(setq major-mode 'package-menu-mode)
(setq mode-name "Package Menu")
(setq truncate-lines t)
(setq buffer-read-only t)
(set (make-local-variable 'revert-buffer-function) 'package-menu-revert)
......@@ -1326,8 +1320,7 @@ Letters do not insert themselves; instead, they are commands.
(20 . "Version")
(32 . "Status")
(43 . "Description"))
""))
(run-mode-hooks 'package-menu-mode-hook))
"")))
(defun package-menu-refresh ()
"Download the Emacs Lisp package archive.
......
......@@ -117,26 +117,12 @@
(sort-fields col (point-min) (point-max))
(sort-numeric-fields col (point-min) (point-max))))))
(defvar erc-list-menu-mode-map
(let ((map (make-keymap)))
(suppress-keymap map)
(define-key map "k" 'erc-list-kill)
(define-key map "j" 'erc-list-join)
(define-key map "g" 'erc-list-revert)
(define-key map "n" 'next-line)
(define-key map "p" 'previous-line)
(define-key map "q" 'quit-window)
map)
"Local keymap for `erc-list-mode' buffers.")
(defvar erc-list-menu-sort-button-map nil
"Local keymap for ERC list menu mode sorting buttons.")
(unless erc-list-menu-sort-button-map
(defvar erc-list-menu-sort-button-map
(let ((map (make-sparse-keymap)))
(define-key map [header-line mouse-1] 'erc-list-menu-sort-by-column)
(define-key map [follow-link] 'mouse-face)
(setq erc-list-menu-sort-button-map map)))
map)
"Local keymap for ERC list menu mode sorting buttons.")
;; Helper function that makes a buttonized column header.
(defun erc-list-button (title column)
......@@ -146,7 +132,7 @@
'mouse-face 'highlight
'keymap erc-list-menu-sort-button-map))
(define-derived-mode erc-list-menu-mode nil "ERC-List"
(define-derived-mode erc-list-menu-mode special-mode "ERC-List"
"Major mode for editing a list of irc channels."
(setq header-line-format
(concat
......@@ -160,6 +146,12 @@
(put 'erc-list-menu-mode 'mode-class 'special)
(define-key erc-list-menu-mode-map "k" 'erc-list-kill)
(define-key erc-list-menu-mode-map "j" 'erc-list-join)
(define-key erc-list-menu-mode-map "g" 'erc-list-revert)
(define-key erc-list-menu-mode-map "n" 'next-line)
(define-key erc-list-menu-mode-map "p" 'previous-line)
;; Handle a "322" response. This response tells us about a single
;; channel.
(defun erc-list-handle-322 (proc parsed)
......
......@@ -305,8 +305,7 @@ This variable is used to display the current image type in the mode line.")
(defvar image-mode-map
(let ((map (make-sparse-keymap)))
(suppress-keymap map)
(define-key map "q" 'quit-window)
(set-keymap-parent map special-mode-map)
(define-key map "\C-c\C-c" 'image-toggle-display)
(define-key map (kbd "SPC") 'image-scroll-up)
(define-key map (kbd "DEL") 'image-scroll-down)
......@@ -385,7 +384,6 @@ to toggle between display as an image and display as text."
(funcall
(if (called-interactively-p 'any) 'error 'message)
"Cannot display image: %s" (cdr err)))))
;;;###autoload
(define-minor-mode image-minor-mode
"Toggle Image minor mode.
......
......@@ -446,7 +446,12 @@ If there is no registered search engine at all, the function returns `nil'."
;;; Search buffers.
(define-derived-mode xesam-mode nil "Xesam"
(defvar xesam-mode-map
(let ((map (copy-keymap special-mode-map)))
(set-keymap-parent xesam-mode-map widget-keymap)
map))
(define-derived-mode xesam-mode special-mode "Xesam"
"Major mode for presenting search results of a Xesam search.
In this mode, widgets represent the search results.
......@@ -455,12 +460,6 @@ Turning on Xesam mode runs the normal hook `xesam-mode-hook'. It
can be used to set `xesam-notify-function', which must a search
engine specific, widget :notify function to visualize xesam:url."
(set (make-local-variable 'xesam-notify-function) nil)
;; Keymap.
(setq xesam-mode-map (copy-keymap special-mode-map))
(set-keymap-parent xesam-mode-map widget-keymap)
(define-key xesam-mode-map "z" 'kill-this-buffer)
;; Maybe we implement something useful, later on.
(set (make-local-variable 'revert-buffer-function) 'ignore)
;; `xesam-engine', `xesam-search', `xesam-type', `xesam-query', and
......
......@@ -41,54 +41,10 @@
:type 'hook
:group 'solitaire)
(defvar solitaire-mode-map
(let ((map (make-sparse-keymap)))
(suppress-keymap map t)
(define-key map "\C-f" 'solitaire-right)
(define-key map "\C-b" 'solitaire-left)
(define-key map "\C-p" 'solitaire-up)
(define-key map "\C-n" 'solitaire-down)
(define-key map "\r" 'solitaire-move)
(define-key map [remap undo] 'solitaire-undo)
(define-key map " " 'solitaire-do-check)
(define-key map "q" 'quit-window)
(define-key map [right] 'solitaire-right)
(define-key map [left] 'solitaire-left)
(define-key map [up] 'solitaire-up)
(define-key map [down] 'solitaire-down)
(define-key map [S-right] 'solitaire-move-right)
(define-key map [S-left] 'solitaire-move-left)
(define-key map [S-up] 'solitaire-move-up)
(define-key map [S-down] 'solitaire-move-down)
(define-key map [kp-6] 'solitaire-right)
(define-key map [kp-4] 'solitaire-left)
(define-key map [kp-8] 'solitaire-up)
(define-key map [kp-2] 'solitaire-down)
(define-key map [kp-5] 'solitaire-center-point)
(define-key map [S-kp-6] 'solitaire-move-right)
(define-key map [S-kp-4] 'solitaire-move-left)
(define-key map [S-kp-8] 'solitaire-move-up)
(define-key map [S-kp-2] 'solitaire-move-down)
(define-key map [kp-enter] 'solitaire-move)
(define-key map [kp-0] 'solitaire-undo)
;; spoil it with s ;)
(define-key map [?s] 'solitaire-solve)
;; (define-key map [kp-0] 'solitaire-hint) - Not yet provided ;)
map)
"Keymap for playing Solitaire.")
;; Solitaire mode is suitable only for specially formatted data.
(put 'solitaire-mode 'mode-class 'special)
(define-derived-mode solitaire-mode nil "Solitaire"
(define-derived-mode solitaire-mode special-mode "Solitaire"
"Major mode for playing Solitaire.
To learn how to play Solitaire, see the documentation for function
`solitaire'.
......@@ -98,6 +54,41 @@ The usual mnemonic keys move the cursor around the board; in addition,
(setq truncate-lines t)
(setq show-trailing-whitespace nil))
(define-key solitaire-mode-map "\C-f" 'solitaire-right)
(define-key solitaire-mode-map "\C-b" 'solitaire-left)
(define-key solitaire-mode-map "\C-p" 'solitaire-up)
(define-key solitaire-mode-map "\C-n" 'solitaire-down)
(define-key solitaire-mode-map "\r" 'solitaire-move)
(define-key solitaire-mode-map [remap undo] 'solitaire-undo)
(define-key solitaire-mode-map " " 'solitaire-do-check)
(define-key solitaire-mode-map [right] 'solitaire-right)
(define-key solitaire-mode-map [left] 'solitaire-left)
(define-key solitaire-mode-map [up] 'solitaire-up)
(define-key solitaire-mode-map [down] 'solitaire-down)
(define-key solitaire-mode-map [S-right] 'solitaire-move-right)
(define-key solitaire-mode-map [S-left] 'solitaire-move-left)
(define-key solitaire-mode-map [S-up] 'solitaire-move-up)
(define-key solitaire-mode-map [S-down] 'solitaire-move-down)
(define-key solitaire-mode-map [kp-6] 'solitaire-right)
(define-key solitaire-mode-map [kp-4] 'solitaire-left)
(define-key solitaire-mode-map [kp-8] 'solitaire-up)
(define-key solitaire-mode-map [kp-2] 'solitaire-down)
(define-key solitaire-mode-map [kp-5] 'solitaire-center-point)
(define-key solitaire-mode-map [S-kp-6] 'solitaire-move-right)
(define-key solitaire-mode-map [S-kp-4] 'solitaire-move-left)
(define-key solitaire-mode-map [S-kp-8] 'solitaire-move-up)
(define-key solitaire-mode-map [S-kp-2] 'solitaire-move-down)
(define-key solitaire-mode-map [kp-enter] 'solitaire-move)
(define-key solitaire-mode-map [kp-0] 'solitaire-undo)
;; spoil it with s ;)
(define-key solitaire-mode-map [?s] 'solitaire-solve)
;; (define-key map [kp-0] 'solitaire-hint) - Not yet provided ;)
(defvar solitaire-stones 0
"Counter for the stones that are still there.")
......
......@@ -862,7 +862,7 @@ POS and RES.")
(< (cdr compilation--previous-directory-cache) pos)))
;; No need to call previous-single-property-change.
(cdr compilation--previous-directory-cache)
(let* ((cache (and compilation--previous-directory-cache
(<= (car compilation--previous-directory-cache) pos)
(car compilation--previous-directory-cache)))
......@@ -1711,6 +1711,7 @@ Returns the compilation buffer created."
(defvar compilation-minor-mode-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map special-mode-map)
(define-key map [mouse-2] 'compile-goto-error)
(define-key map [follow-link] 'mouse-face)
(define-key map "\C-c\C-c" 'compile-goto-error)
......@@ -1721,7 +1722,6 @@ Returns the compilation buffer created."
(define-key map "\M-{" 'compilation-previous-file)
(define-key map "\M-}" 'compilation-next-file)
(define-key map "g" 'recompile) ; revert
(define-key map "q" 'quit-window)
;; Set up the menu-bar
(define-key map [menu-bar compilation]
(cons "Errors" compilation-menu-map))
......@@ -1755,6 +1755,7 @@ Returns the compilation buffer created."
;; Don't inherit from compilation-minor-mode-map,
;; because that introduces a menu bar item we don't want.
;; That confuses C-down-mouse-3.
(set-keymap-parent map special-mode-map)
(define-key map [mouse-2] 'compile-goto-error)
(define-key map [follow-link] 'mouse-face)
(define-key map "\C-c\C-c" 'compile-goto-error)
......@@ -1767,10 +1768,7 @@ Returns the compilation buffer created."
(define-key map "\t" 'compilation-next-error)
(define-key map [backtab] 'compilation-previous-error)
(define-key map "g" 'recompile) ; revert
(define-key map "q" 'quit-window)
(define-key map " " 'scroll-up)
(define-key map "\^?" 'scroll-down)
(define-key map "\C-c\C-f" 'next-error-follow-minor-mode)
;; Set up the menu-bar
......
......@@ -757,63 +757,6 @@ a previously found match."
count)))
(defvar occur-mode-map
(let ((map (make-sparse-keymap)))
;; We use this alternative name, so we can use \\[occur-mode-mouse-goto].
(define-key map [mouse-2] 'occur-mode-mouse-goto)
(define-key map "\C-c\C-c" 'occur-mode-goto-occurrence)
(define-key map "\C-m" 'occur-mode-goto-occurrence)
(define-key map "o" 'occur-mode-goto-occurrence-other-window)
(define-key map "\C-o" 'occur-mode-display-occurrence)
(define-key map "\M-n" 'occur-next)
(define-key map "\M-p" 'occur-prev)
(define-key map "r" 'occur-rename-buffer)
(define-key map "c" 'clone-buffer)
(define-key map "g" 'revert-buffer)
(define-key map "q" 'quit-window)
(define-key map "z" 'kill-this-buffer)
(define-key map "\C-c\C-f" 'next-error-follow-minor-mode)
(define-key map [menu-bar] (make-sparse-keymap))
(define-key map [menu-bar occur]
`(cons ,(purecopy "Occur") map))
(define-key map [next-error-follow-minor-mode]
(menu-bar-make-mm-toggle next-error-follow-minor-mode
"Auto Occurrence Display"
"Display another occurrence when moving the cursor"))
(define-key map [separator-1] menu-bar-separator)
(define-key map [kill-this-buffer]
`(menu-item ,(purecopy "Kill occur buffer") kill-this-buffer
:help ,(purecopy "Kill the current *Occur* buffer")))
(define-key map [quit-window]
`(menu-item ,(purecopy "Quit occur window") quit-window
:help ,(purecopy "Quit the current *Occur* buffer. Bury it, and maybe delete the selected frame")))
(define-key map [revert-buffer]
`(menu-item ,(purecopy "Revert occur buffer") revert-buffer
:help ,(purecopy "Replace the text in the *Occur* buffer with the results of rerunning occur")))
(define-key map [clone-buffer]
`(menu-item ,(purecopy "Clone occur buffer") clone-buffer
:help ,(purecopy "Create and return a twin copy of the current *Occur* buffer")))
(define-key map [occur-rename-buffer]