2021-01-05 01:57:42 +00:00
|
|
|
|
;;; bindings.el --- define standard key bindings and some variables -*- lexical-binding: t; -*-
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
2021-01-01 09:13:56 +00:00
|
|
|
|
;; Copyright (C) 1985-1987, 1992-1996, 1999-2021 Free Software
|
2013-01-01 09:11:05 +00:00
|
|
|
|
;; Foundation, Inc.
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
2019-05-25 20:43:06 +00:00
|
|
|
|
;; Maintainer: emacs-devel@gnu.org
|
1996-09-11 19:05:36 +00:00
|
|
|
|
;; Keywords: internal
|
2010-08-29 16:17:13 +00:00
|
|
|
|
;; Package: emacs
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1996-09-11 19:05:36 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 22:52:52 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
2001-08-09 14:06:54 +00:00
|
|
|
|
(defun make-mode-line-mouse-map (mouse function) "\
|
|
|
|
|
Return a keymap with single entry for mouse key MOUSE on the mode line.
|
|
|
|
|
MOUSE is defined to run function FUNCTION with no args in the buffer
|
2000-01-07 14:16:07 +00:00
|
|
|
|
corresponding to the mode line clicked."
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
2001-08-09 14:06:54 +00:00
|
|
|
|
(define-key map (vector 'mode-line mouse) function)
|
2000-01-07 14:16:07 +00:00
|
|
|
|
map))
|
|
|
|
|
|
2000-11-06 16:43:42 +00:00
|
|
|
|
|
|
|
|
|
(defun mode-line-toggle-read-only (event)
|
2014-07-21 05:38:17 +00:00
|
|
|
|
"Like toggling `read-only-mode', for the mode-line."
|
2000-11-06 16:43:42 +00:00
|
|
|
|
(interactive "e")
|
2012-10-09 06:41:07 +00:00
|
|
|
|
(with-selected-window (posn-window (event-start event))
|
2012-09-23 10:21:34 +00:00
|
|
|
|
(read-only-mode 'toggle)))
|
2000-11-06 16:43:42 +00:00
|
|
|
|
|
|
|
|
|
(defun mode-line-toggle-modified (event)
|
|
|
|
|
"Toggle the buffer-modified flag from the mode-line."
|
2000-11-18 12:34:44 +00:00
|
|
|
|
(interactive "e")
|
2012-10-09 06:41:07 +00:00
|
|
|
|
(with-selected-window (posn-window (event-start event))
|
2000-11-06 16:43:42 +00:00
|
|
|
|
(set-buffer-modified-p (not (buffer-modified-p)))
|
|
|
|
|
(force-mode-line-update)))
|
|
|
|
|
|
|
|
|
|
(defun mode-line-widen (event)
|
|
|
|
|
"Widen a buffer from the mode-line."
|
2000-11-18 12:34:44 +00:00
|
|
|
|
(interactive "e")
|
2012-10-09 06:41:07 +00:00
|
|
|
|
(with-selected-window (posn-window (event-start event))
|
2000-11-06 16:43:42 +00:00
|
|
|
|
(widen)
|
|
|
|
|
(force-mode-line-update)))
|
|
|
|
|
|
2000-02-09 12:18:48 +00:00
|
|
|
|
(defvar mode-line-input-method-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(define-key map [mode-line mouse-2]
|
|
|
|
|
(lambda (e)
|
|
|
|
|
(interactive "e")
|
2012-10-09 06:41:07 +00:00
|
|
|
|
(with-selected-window (posn-window (event-start e))
|
2000-02-09 12:18:48 +00:00
|
|
|
|
(toggle-input-method)
|
|
|
|
|
(force-mode-line-update))))
|
|
|
|
|
(define-key map [mode-line mouse-3]
|
|
|
|
|
(lambda (e)
|
|
|
|
|
(interactive "e")
|
2012-10-09 06:41:07 +00:00
|
|
|
|
(with-selected-window (posn-window (event-start e))
|
2000-02-09 12:18:48 +00:00
|
|
|
|
(describe-current-input-method))))
|
|
|
|
|
(purecopy map)))
|
|
|
|
|
|
2001-08-30 14:19:34 +00:00
|
|
|
|
(defvar mode-line-coding-system-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
2005-09-15 04:12:27 +00:00
|
|
|
|
(define-key map [mode-line mouse-1]
|
2001-08-30 14:19:34 +00:00
|
|
|
|
(lambda (e)
|
|
|
|
|
(interactive "e")
|
2012-10-09 06:41:07 +00:00
|
|
|
|
(with-selected-window (posn-window (event-start e))
|
2001-08-30 14:19:34 +00:00
|
|
|
|
(when (and enable-multibyte-characters
|
|
|
|
|
buffer-file-coding-system)
|
|
|
|
|
(describe-coding-system buffer-file-coding-system)))))
|
2012-06-03 10:54:22 +00:00
|
|
|
|
(define-key map [mode-line mouse-3]
|
|
|
|
|
(lambda (e)
|
|
|
|
|
(interactive "e")
|
2012-10-09 06:41:07 +00:00
|
|
|
|
(with-selected-window (posn-window (event-start e))
|
2012-06-03 10:54:22 +00:00
|
|
|
|
(call-interactively 'set-buffer-file-coding-system))))
|
2001-08-30 14:19:34 +00:00
|
|
|
|
(purecopy map))
|
|
|
|
|
"Local keymap for the coding-system part of the mode line.")
|
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(defun mode-line-change-eol (event)
|
2002-11-02 06:13:57 +00:00
|
|
|
|
"Cycle through the various possible kinds of end-of-line styles."
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(interactive "e")
|
2008-03-26 03:32:46 +00:00
|
|
|
|
(with-selected-window (posn-window (event-start event))
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(let ((eol (coding-system-eol-type buffer-file-coding-system)))
|
|
|
|
|
(set-buffer-file-coding-system
|
|
|
|
|
(cond ((eq eol 0) 'dos) ((eq eol 1) 'mac) (t 'unix))))))
|
2002-11-02 06:13:57 +00:00
|
|
|
|
|
|
|
|
|
(defvar mode-line-eol-desc-cache nil)
|
|
|
|
|
|
|
|
|
|
(defun mode-line-eol-desc ()
|
|
|
|
|
(let* ((eol (coding-system-eol-type buffer-file-coding-system))
|
|
|
|
|
(mnemonic (coding-system-eol-type-mnemonic buffer-file-coding-system))
|
2008-12-20 07:20:32 +00:00
|
|
|
|
(desc (assoc eol mode-line-eol-desc-cache)))
|
2002-11-02 06:13:57 +00:00
|
|
|
|
(if (and desc (eq (cadr desc) mnemonic))
|
|
|
|
|
(cddr desc)
|
|
|
|
|
(if desc (setq mode-line-eol-desc-cache nil)) ;Flush the cache if stale.
|
|
|
|
|
(setq desc
|
|
|
|
|
(propertize
|
|
|
|
|
mnemonic
|
2012-06-03 10:23:49 +00:00
|
|
|
|
'help-echo (format "End-of-line style: %s\nmouse-1: Cycle"
|
2002-11-02 06:13:57 +00:00
|
|
|
|
(if (eq eol 0) "Unix-style LF"
|
2009-01-02 17:04:21 +00:00
|
|
|
|
(if (eq eol 1) "DOS-style CRLF"
|
2002-11-02 06:13:57 +00:00
|
|
|
|
(if (eq eol 2) "Mac-style CR"
|
|
|
|
|
"Undecided"))))
|
|
|
|
|
'keymap
|
|
|
|
|
(eval-when-compile
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
2005-09-15 04:12:27 +00:00
|
|
|
|
(define-key map [mode-line mouse-1] 'mode-line-change-eol)
|
2005-05-23 11:19:17 +00:00
|
|
|
|
map))
|
|
|
|
|
'mouse-face 'mode-line-highlight))
|
2002-11-02 06:13:57 +00:00
|
|
|
|
(push (cons eol (cons mnemonic desc)) mode-line-eol-desc-cache)
|
|
|
|
|
desc)))
|
|
|
|
|
|
2012-06-03 09:03:23 +00:00
|
|
|
|
|
|
|
|
|
;;; Mode line contents
|
|
|
|
|
|
Fix some tooltip related problems
Replace 'tooltip' frame parameter with a 'tooltip' member in
the frame structure. For GTK+ builds use 'tip_last_frame' to
find the frame for which the currently visible tooltip was
made. For modeline help-echoing have tooltips show applicable
actions only.
* lisp/bindings.el (mode-line-default-help-echo): New function
as default value of homonymous option.
* src/dispextern.h (tip_frame, tip_window): Remove
declarations.
* src/frame.c (make_frame): Initialize new frame structure
member 'tooltip'.
(Fframe_list, other_frames): Rewrite with new macro
FRAME_TOOLTIP_P.
* src/frame.h (struct frame): New member 'tooltip'.
(FRAME_TOOLTIP_P): New macro.
* src/gtkutil.c (xg_prepare_tooltip, xg_hide_tooltip): Rewrite
using boolean return values.
* src/nsfns.m (tip_frame): Remove declaration.
* src/w32fns.c (w32_display_monitor_attributes_list)
(w32_display_monitor_attributes_list_fallback): Rewrite with
new macro FRAME_TOOLTIP_P.
(tip_last_string, tip_last_frame, tip_last_parms): New Lisp
scalars replacing Lisp vector last_show_tip_args.
(x_create_tip_frame): Set new frame's 'tooltip' structure
member to true.
(x_hide_tip): Additionally test tip_frame for liveness.
(Fx_show_tip): Handle last_show_tip_args to tip_last_frame,
tip_last_string and tip_last_parms conversion.
(syms_of_w32fns): staticpro tip_last_frame, tip_last_string
and tip_last_parms instead of last_show_tip_args.
* src/w32term.c (w32_read_socket, x_new_font): Rewrite with
new macro FRAME_TOOLTIP_P.
* src/w32term.h (tip_window): Add external declaration.
* src/xdisp.c (x_consider_frame_title, prepare_menu_bars)
(should_produce_line_number): Rewrite with new macro
FRAME_TOOLTIP_P.
(note_mode_line_or_margin_highlight): If
`mode-line-default-help-echo' specifies a function, call it to
produce help echo string.
* src/xfns.c (x_make_monitor_attribute_list)
(Fx_display_monitor_attributes_list): Rewrite with
new macro FRAME_TOOLTIP_P.
(tip_last_string, tip_last_frame, tip_last_parms): New Lisp
scalars replacing Lisp vector last_show_tip_args.
(x_create_tip_frame): Set new frame's 'tooltip' structure
member to true.
(x_hide_tip): Rewrite with additional tests of frames for
liveness and taking into account that for GTK+ tips the
reference frame is now stored in tip_last_frame instead of
tip_frame.
(Fx_show_tip): Handle last_show_tip_args to tip_last_frame,
tip_last_string and tip_last_parms conversion. For GTK+ store
FRAME argument in tip_last-frame.
(syms_of_xfns): staticpro tip_last_frame, tip_last_string
and tip_last_parms instead of last_show_tip_args.
* src/xterm.c (x_update_begin, handle_one_xevent, x_new_font)
(x_set_window_size): Rewrite with new macro FRAME_TOOLTIP_P.
* src/xterm.h (tip_window): Add external declaration.
* etc/NEWS: Mention new modeline tooltips behavior.
2018-01-18 09:36:47 +00:00
|
|
|
|
(defun mode-line-default-help-echo (window)
|
2018-01-27 07:29:18 +00:00
|
|
|
|
"Return default help echo text for WINDOW's mode line."
|
Fix some tooltip related problems
Replace 'tooltip' frame parameter with a 'tooltip' member in
the frame structure. For GTK+ builds use 'tip_last_frame' to
find the frame for which the currently visible tooltip was
made. For modeline help-echoing have tooltips show applicable
actions only.
* lisp/bindings.el (mode-line-default-help-echo): New function
as default value of homonymous option.
* src/dispextern.h (tip_frame, tip_window): Remove
declarations.
* src/frame.c (make_frame): Initialize new frame structure
member 'tooltip'.
(Fframe_list, other_frames): Rewrite with new macro
FRAME_TOOLTIP_P.
* src/frame.h (struct frame): New member 'tooltip'.
(FRAME_TOOLTIP_P): New macro.
* src/gtkutil.c (xg_prepare_tooltip, xg_hide_tooltip): Rewrite
using boolean return values.
* src/nsfns.m (tip_frame): Remove declaration.
* src/w32fns.c (w32_display_monitor_attributes_list)
(w32_display_monitor_attributes_list_fallback): Rewrite with
new macro FRAME_TOOLTIP_P.
(tip_last_string, tip_last_frame, tip_last_parms): New Lisp
scalars replacing Lisp vector last_show_tip_args.
(x_create_tip_frame): Set new frame's 'tooltip' structure
member to true.
(x_hide_tip): Additionally test tip_frame for liveness.
(Fx_show_tip): Handle last_show_tip_args to tip_last_frame,
tip_last_string and tip_last_parms conversion.
(syms_of_w32fns): staticpro tip_last_frame, tip_last_string
and tip_last_parms instead of last_show_tip_args.
* src/w32term.c (w32_read_socket, x_new_font): Rewrite with
new macro FRAME_TOOLTIP_P.
* src/w32term.h (tip_window): Add external declaration.
* src/xdisp.c (x_consider_frame_title, prepare_menu_bars)
(should_produce_line_number): Rewrite with new macro
FRAME_TOOLTIP_P.
(note_mode_line_or_margin_highlight): If
`mode-line-default-help-echo' specifies a function, call it to
produce help echo string.
* src/xfns.c (x_make_monitor_attribute_list)
(Fx_display_monitor_attributes_list): Rewrite with
new macro FRAME_TOOLTIP_P.
(tip_last_string, tip_last_frame, tip_last_parms): New Lisp
scalars replacing Lisp vector last_show_tip_args.
(x_create_tip_frame): Set new frame's 'tooltip' structure
member to true.
(x_hide_tip): Rewrite with additional tests of frames for
liveness and taking into account that for GTK+ tips the
reference frame is now stored in tip_last_frame instead of
tip_frame.
(Fx_show_tip): Handle last_show_tip_args to tip_last_frame,
tip_last_string and tip_last_parms conversion. For GTK+ store
FRAME argument in tip_last-frame.
(syms_of_xfns): staticpro tip_last_frame, tip_last_string
and tip_last_parms instead of last_show_tip_args.
* src/xterm.c (x_update_begin, handle_one_xevent, x_new_font)
(x_set_window_size): Rewrite with new macro FRAME_TOOLTIP_P.
* src/xterm.h (tip_window): Add external declaration.
* etc/NEWS: Mention new modeline tooltips behavior.
2018-01-18 09:36:47 +00:00
|
|
|
|
(let* ((frame (window-frame window))
|
|
|
|
|
(line-1a
|
|
|
|
|
;; Show text to select window only if the window is not
|
|
|
|
|
;; selected.
|
|
|
|
|
(not (eq window (frame-selected-window frame))))
|
|
|
|
|
(line-1b
|
2018-01-27 07:29:18 +00:00
|
|
|
|
;; Show text to drag mode line if either the window is not
|
|
|
|
|
;; at the bottom of its frame or the minibuffer window of
|
|
|
|
|
;; this frame can be resized. This matches a corresponding
|
|
|
|
|
;; check in `mouse-drag-mode-line'.
|
|
|
|
|
(or (not (window-at-side-p window 'bottom))
|
Fix some tooltip related problems
Replace 'tooltip' frame parameter with a 'tooltip' member in
the frame structure. For GTK+ builds use 'tip_last_frame' to
find the frame for which the currently visible tooltip was
made. For modeline help-echoing have tooltips show applicable
actions only.
* lisp/bindings.el (mode-line-default-help-echo): New function
as default value of homonymous option.
* src/dispextern.h (tip_frame, tip_window): Remove
declarations.
* src/frame.c (make_frame): Initialize new frame structure
member 'tooltip'.
(Fframe_list, other_frames): Rewrite with new macro
FRAME_TOOLTIP_P.
* src/frame.h (struct frame): New member 'tooltip'.
(FRAME_TOOLTIP_P): New macro.
* src/gtkutil.c (xg_prepare_tooltip, xg_hide_tooltip): Rewrite
using boolean return values.
* src/nsfns.m (tip_frame): Remove declaration.
* src/w32fns.c (w32_display_monitor_attributes_list)
(w32_display_monitor_attributes_list_fallback): Rewrite with
new macro FRAME_TOOLTIP_P.
(tip_last_string, tip_last_frame, tip_last_parms): New Lisp
scalars replacing Lisp vector last_show_tip_args.
(x_create_tip_frame): Set new frame's 'tooltip' structure
member to true.
(x_hide_tip): Additionally test tip_frame for liveness.
(Fx_show_tip): Handle last_show_tip_args to tip_last_frame,
tip_last_string and tip_last_parms conversion.
(syms_of_w32fns): staticpro tip_last_frame, tip_last_string
and tip_last_parms instead of last_show_tip_args.
* src/w32term.c (w32_read_socket, x_new_font): Rewrite with
new macro FRAME_TOOLTIP_P.
* src/w32term.h (tip_window): Add external declaration.
* src/xdisp.c (x_consider_frame_title, prepare_menu_bars)
(should_produce_line_number): Rewrite with new macro
FRAME_TOOLTIP_P.
(note_mode_line_or_margin_highlight): If
`mode-line-default-help-echo' specifies a function, call it to
produce help echo string.
* src/xfns.c (x_make_monitor_attribute_list)
(Fx_display_monitor_attributes_list): Rewrite with
new macro FRAME_TOOLTIP_P.
(tip_last_string, tip_last_frame, tip_last_parms): New Lisp
scalars replacing Lisp vector last_show_tip_args.
(x_create_tip_frame): Set new frame's 'tooltip' structure
member to true.
(x_hide_tip): Rewrite with additional tests of frames for
liveness and taking into account that for GTK+ tips the
reference frame is now stored in tip_last_frame instead of
tip_frame.
(Fx_show_tip): Handle last_show_tip_args to tip_last_frame,
tip_last_string and tip_last_parms conversion. For GTK+ store
FRAME argument in tip_last-frame.
(syms_of_xfns): staticpro tip_last_frame, tip_last_string
and tip_last_parms instead of last_show_tip_args.
* src/xterm.c (x_update_begin, handle_one_xevent, x_new_font)
(x_set_window_size): Rewrite with new macro FRAME_TOOLTIP_P.
* src/xterm.h (tip_window): Add external declaration.
* etc/NEWS: Mention new modeline tooltips behavior.
2018-01-18 09:36:47 +00:00
|
|
|
|
(let ((mini-window (minibuffer-window frame)))
|
|
|
|
|
(and (eq frame (window-frame mini-window))
|
|
|
|
|
(or (minibuffer-window-active-p mini-window)
|
|
|
|
|
(not resize-mini-windows))))))
|
|
|
|
|
(line-2
|
|
|
|
|
;; Show text make window occupy the whole frame
|
|
|
|
|
;; only if it doesn't already do that.
|
|
|
|
|
(not (eq window (frame-root-window frame))))
|
|
|
|
|
(line-3
|
|
|
|
|
;; Show text to delete window only if that's possible.
|
|
|
|
|
(not (eq window (frame-root-window frame)))))
|
|
|
|
|
(when (or line-1a line-1b line-2 line-3)
|
|
|
|
|
(concat
|
|
|
|
|
(when (or line-1a line-1b)
|
|
|
|
|
(concat
|
|
|
|
|
"mouse-1: "
|
|
|
|
|
(when line-1a "Select window")
|
|
|
|
|
(when line-1b
|
|
|
|
|
(if line-1a " (drag to resize)" "Drag to resize"))
|
|
|
|
|
(when (or line-2 line-3) "\n")))
|
|
|
|
|
(when line-2
|
|
|
|
|
(concat
|
|
|
|
|
"mouse-2: Make window occupy whole frame"
|
|
|
|
|
(when line-3 "\n")))
|
|
|
|
|
(when line-3
|
|
|
|
|
"mouse-3: Remove window from frame")))))
|
|
|
|
|
|
|
|
|
|
(defcustom mode-line-default-help-echo #'mode-line-default-help-echo
|
2012-06-03 09:03:23 +00:00
|
|
|
|
"Default help text for the mode line.
|
|
|
|
|
If the value is a string, it specifies the tooltip or echo area
|
|
|
|
|
message to display when the mouse is moved over the mode line.
|
Fix some tooltip related problems
Replace 'tooltip' frame parameter with a 'tooltip' member in
the frame structure. For GTK+ builds use 'tip_last_frame' to
find the frame for which the currently visible tooltip was
made. For modeline help-echoing have tooltips show applicable
actions only.
* lisp/bindings.el (mode-line-default-help-echo): New function
as default value of homonymous option.
* src/dispextern.h (tip_frame, tip_window): Remove
declarations.
* src/frame.c (make_frame): Initialize new frame structure
member 'tooltip'.
(Fframe_list, other_frames): Rewrite with new macro
FRAME_TOOLTIP_P.
* src/frame.h (struct frame): New member 'tooltip'.
(FRAME_TOOLTIP_P): New macro.
* src/gtkutil.c (xg_prepare_tooltip, xg_hide_tooltip): Rewrite
using boolean return values.
* src/nsfns.m (tip_frame): Remove declaration.
* src/w32fns.c (w32_display_monitor_attributes_list)
(w32_display_monitor_attributes_list_fallback): Rewrite with
new macro FRAME_TOOLTIP_P.
(tip_last_string, tip_last_frame, tip_last_parms): New Lisp
scalars replacing Lisp vector last_show_tip_args.
(x_create_tip_frame): Set new frame's 'tooltip' structure
member to true.
(x_hide_tip): Additionally test tip_frame for liveness.
(Fx_show_tip): Handle last_show_tip_args to tip_last_frame,
tip_last_string and tip_last_parms conversion.
(syms_of_w32fns): staticpro tip_last_frame, tip_last_string
and tip_last_parms instead of last_show_tip_args.
* src/w32term.c (w32_read_socket, x_new_font): Rewrite with
new macro FRAME_TOOLTIP_P.
* src/w32term.h (tip_window): Add external declaration.
* src/xdisp.c (x_consider_frame_title, prepare_menu_bars)
(should_produce_line_number): Rewrite with new macro
FRAME_TOOLTIP_P.
(note_mode_line_or_margin_highlight): If
`mode-line-default-help-echo' specifies a function, call it to
produce help echo string.
* src/xfns.c (x_make_monitor_attribute_list)
(Fx_display_monitor_attributes_list): Rewrite with
new macro FRAME_TOOLTIP_P.
(tip_last_string, tip_last_frame, tip_last_parms): New Lisp
scalars replacing Lisp vector last_show_tip_args.
(x_create_tip_frame): Set new frame's 'tooltip' structure
member to true.
(x_hide_tip): Rewrite with additional tests of frames for
liveness and taking into account that for GTK+ tips the
reference frame is now stored in tip_last_frame instead of
tip_frame.
(Fx_show_tip): Handle last_show_tip_args to tip_last_frame,
tip_last_string and tip_last_parms conversion. For GTK+ store
FRAME argument in tip_last-frame.
(syms_of_xfns): staticpro tip_last_frame, tip_last_string
and tip_last_parms instead of last_show_tip_args.
* src/xterm.c (x_update_begin, handle_one_xevent, x_new_font)
(x_set_window_size): Rewrite with new macro FRAME_TOOLTIP_P.
* src/xterm.h (tip_window): Add external declaration.
* etc/NEWS: Mention new modeline tooltips behavior.
2018-01-18 09:36:47 +00:00
|
|
|
|
If the value is a function, call that function with one argument
|
2018-01-27 07:29:18 +00:00
|
|
|
|
- the window whose mode line to display. If the text at the
|
Fix some tooltip related problems
Replace 'tooltip' frame parameter with a 'tooltip' member in
the frame structure. For GTK+ builds use 'tip_last_frame' to
find the frame for which the currently visible tooltip was
made. For modeline help-echoing have tooltips show applicable
actions only.
* lisp/bindings.el (mode-line-default-help-echo): New function
as default value of homonymous option.
* src/dispextern.h (tip_frame, tip_window): Remove
declarations.
* src/frame.c (make_frame): Initialize new frame structure
member 'tooltip'.
(Fframe_list, other_frames): Rewrite with new macro
FRAME_TOOLTIP_P.
* src/frame.h (struct frame): New member 'tooltip'.
(FRAME_TOOLTIP_P): New macro.
* src/gtkutil.c (xg_prepare_tooltip, xg_hide_tooltip): Rewrite
using boolean return values.
* src/nsfns.m (tip_frame): Remove declaration.
* src/w32fns.c (w32_display_monitor_attributes_list)
(w32_display_monitor_attributes_list_fallback): Rewrite with
new macro FRAME_TOOLTIP_P.
(tip_last_string, tip_last_frame, tip_last_parms): New Lisp
scalars replacing Lisp vector last_show_tip_args.
(x_create_tip_frame): Set new frame's 'tooltip' structure
member to true.
(x_hide_tip): Additionally test tip_frame for liveness.
(Fx_show_tip): Handle last_show_tip_args to tip_last_frame,
tip_last_string and tip_last_parms conversion.
(syms_of_w32fns): staticpro tip_last_frame, tip_last_string
and tip_last_parms instead of last_show_tip_args.
* src/w32term.c (w32_read_socket, x_new_font): Rewrite with
new macro FRAME_TOOLTIP_P.
* src/w32term.h (tip_window): Add external declaration.
* src/xdisp.c (x_consider_frame_title, prepare_menu_bars)
(should_produce_line_number): Rewrite with new macro
FRAME_TOOLTIP_P.
(note_mode_line_or_margin_highlight): If
`mode-line-default-help-echo' specifies a function, call it to
produce help echo string.
* src/xfns.c (x_make_monitor_attribute_list)
(Fx_display_monitor_attributes_list): Rewrite with
new macro FRAME_TOOLTIP_P.
(tip_last_string, tip_last_frame, tip_last_parms): New Lisp
scalars replacing Lisp vector last_show_tip_args.
(x_create_tip_frame): Set new frame's 'tooltip' structure
member to true.
(x_hide_tip): Rewrite with additional tests of frames for
liveness and taking into account that for GTK+ tips the
reference frame is now stored in tip_last_frame instead of
tip_frame.
(Fx_show_tip): Handle last_show_tip_args to tip_last_frame,
tip_last_string and tip_last_parms conversion. For GTK+ store
FRAME argument in tip_last-frame.
(syms_of_xfns): staticpro tip_last_frame, tip_last_string
and tip_last_parms instead of last_show_tip_args.
* src/xterm.c (x_update_begin, handle_one_xevent, x_new_font)
(x_set_window_size): Rewrite with new macro FRAME_TOOLTIP_P.
* src/xterm.h (tip_window): Add external declaration.
* etc/NEWS: Mention new modeline tooltips behavior.
2018-01-18 09:36:47 +00:00
|
|
|
|
mouse position has a `help-echo' text property, that overrides
|
|
|
|
|
this variable."
|
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "No help" :value nil)
|
|
|
|
|
function
|
|
|
|
|
(string :value "mouse-1: Select (drag to resize)\n\
|
|
|
|
|
mouse-2: Make current window occupy the whole frame\n\
|
|
|
|
|
mouse-3: Remove current window from display"))
|
|
|
|
|
:version "27.1"
|
2012-06-03 09:03:23 +00:00
|
|
|
|
:group 'mode-line)
|
|
|
|
|
|
|
|
|
|
(defvar mode-line-front-space '(:eval (if (display-graphic-p) " " "-"))
|
|
|
|
|
"Mode line construct to put at the front of the mode line.
|
|
|
|
|
By default, this construct is displayed right at the beginning of
|
|
|
|
|
the mode line, except that if there is a memory-full message, it
|
|
|
|
|
is displayed first.")
|
|
|
|
|
(put 'mode-line-front-space 'risky-local-variable t)
|
2005-12-29 21:11:27 +00:00
|
|
|
|
|
2012-06-03 10:23:49 +00:00
|
|
|
|
(defun mode-line-mule-info-help-echo (window _object _point)
|
|
|
|
|
"Return help text specifying WINDOW's buffer coding system."
|
|
|
|
|
(with-current-buffer (window-buffer window)
|
|
|
|
|
(if buffer-file-coding-system
|
|
|
|
|
(format "Buffer coding system (%s): %s
|
2012-06-03 10:54:22 +00:00
|
|
|
|
mouse-1: Describe coding system
|
|
|
|
|
mouse-3: Set coding system"
|
2012-06-03 10:23:49 +00:00
|
|
|
|
(if enable-multibyte-characters "multi-byte" "unibyte")
|
|
|
|
|
(symbol-name buffer-file-coding-system))
|
|
|
|
|
"Buffer coding system: none specified")))
|
|
|
|
|
|
Prefer defvar-local in preloaded files
* lisp/abbrev.el:
* lisp/bindings.el (mode-line-mule-info, mode-line-modified)
(mode-line-remote, mode-line-process)
(mode-line-buffer-identification):
* lisp/buff-menu.el (Buffer-menu-files-only):
* lisp/files.el (buffer-file-number, buffer-file-read-only)
(local-write-file-hooks, write-contents-functions)
(file-local-variables-alist, dir-local-variables-alist)
(save-buffer-coding-system, buffer-save-without-query):
* lisp/font-core.el (font-lock-defaults):
* lisp/font-lock.el (font-lock-keywords-case-fold-search)
(font-lock-syntactically-fontified)
(font-lock-extend-after-change-region-function)
(font-lock-extend-region-functions, font-lock-major-mode):
* lisp/menu-bar.el (list-buffers-directory):
* lisp/simple.el (next-error--message-highlight-overlay)
(next-error-buffer, next-error-function)
(next-error-move-function, goto-line-history)
(minibuffer-default-add-done, undo-extra-outer-limit):
* lisp/tab-bar.el (tab-switcher-column):
* lisp/term/ns-win.el (ns-select-overlay):
* lisp/window.el (window-size-fixed, window-area-factor)
(window-group-start-function, window-group-end-function)
(set-window-group-start-function)
(recenter-window-group-function)
(pos-visible-in-window-group-p-function)
(selected-window-group-function)
(move-to-window-group-line-function): Prefer defvar-local.
2021-01-31 18:46:20 +00:00
|
|
|
|
(defvar-local mode-line-mule-info
|
2000-01-07 14:16:07 +00:00
|
|
|
|
`(""
|
2000-02-04 20:35:08 +00:00
|
|
|
|
(current-input-method
|
2002-03-28 18:23:08 +00:00
|
|
|
|
(:propertize ("" current-input-method-title)
|
|
|
|
|
help-echo (concat
|
2009-11-11 05:49:09 +00:00
|
|
|
|
,(purecopy "Current input method: ")
|
2002-03-28 18:23:08 +00:00
|
|
|
|
current-input-method
|
2009-11-11 05:49:09 +00:00
|
|
|
|
,(purecopy "\n\
|
2008-02-16 01:45:47 +00:00
|
|
|
|
mouse-2: Disable input method\n\
|
2009-11-11 05:49:09 +00:00
|
|
|
|
mouse-3: Describe current input method"))
|
2005-05-23 11:19:17 +00:00
|
|
|
|
local-map ,mode-line-input-method-map
|
|
|
|
|
mouse-face mode-line-highlight))
|
2000-07-18 21:53:46 +00:00
|
|
|
|
,(propertize
|
2002-11-02 06:13:57 +00:00
|
|
|
|
"%z"
|
2012-06-03 10:23:49 +00:00
|
|
|
|
'help-echo 'mode-line-mule-info-help-echo
|
2005-05-23 11:19:17 +00:00
|
|
|
|
'mouse-face 'mode-line-highlight
|
2002-11-02 06:13:57 +00:00
|
|
|
|
'local-map mode-line-coding-system-map)
|
|
|
|
|
(:eval (mode-line-eol-desc)))
|
2012-06-03 10:23:49 +00:00
|
|
|
|
"Mode line construct to report the multilingual environment.
|
1997-06-18 12:55:15 +00:00
|
|
|
|
Normally it displays current input method (if any activated) and
|
|
|
|
|
mnemonics of the following coding systems:
|
|
|
|
|
coding system for saving or writing the current buffer
|
2012-06-03 10:23:49 +00:00
|
|
|
|
coding system for keyboard input (on a text terminal)
|
|
|
|
|
coding system for terminal output (on a text terminal)")
|
2009-10-15 06:18:02 +00:00
|
|
|
|
;;;###autoload
|
2009-08-26 03:07:25 +00:00
|
|
|
|
(put 'mode-line-mule-info 'risky-local-variable t)
|
1997-02-22 19:23:31 +00:00
|
|
|
|
|
2012-06-03 09:03:23 +00:00
|
|
|
|
(defvar mode-line-client
|
|
|
|
|
`(""
|
|
|
|
|
(:propertize ("" (:eval (if (frame-parameter nil 'client) "@" "")))
|
|
|
|
|
help-echo ,(purecopy "emacsclient frame")))
|
|
|
|
|
"Mode line construct for identifying emacsclient frames.")
|
2009-10-15 06:18:02 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 09:03:23 +00:00
|
|
|
|
(put 'mode-line-client 'risky-local-variable t)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
2012-06-03 10:23:49 +00:00
|
|
|
|
(defun mode-line-read-only-help-echo (window _object _point)
|
|
|
|
|
"Return help text specifying WINDOW's buffer read-only status."
|
|
|
|
|
(format "Buffer is %s\nmouse-1: Toggle"
|
|
|
|
|
(if (buffer-local-value 'buffer-read-only (window-buffer window))
|
|
|
|
|
"read-only"
|
|
|
|
|
"writable")))
|
|
|
|
|
|
|
|
|
|
(defun mode-line-modified-help-echo (window _object _point)
|
|
|
|
|
"Return help text specifying WINDOW's buffer modification status."
|
|
|
|
|
(format "Buffer is %smodified\nmouse-1: Toggle modification state"
|
|
|
|
|
(if (buffer-modified-p (window-buffer window)) "" "not ")))
|
|
|
|
|
|
Prefer defvar-local in preloaded files
* lisp/abbrev.el:
* lisp/bindings.el (mode-line-mule-info, mode-line-modified)
(mode-line-remote, mode-line-process)
(mode-line-buffer-identification):
* lisp/buff-menu.el (Buffer-menu-files-only):
* lisp/files.el (buffer-file-number, buffer-file-read-only)
(local-write-file-hooks, write-contents-functions)
(file-local-variables-alist, dir-local-variables-alist)
(save-buffer-coding-system, buffer-save-without-query):
* lisp/font-core.el (font-lock-defaults):
* lisp/font-lock.el (font-lock-keywords-case-fold-search)
(font-lock-syntactically-fontified)
(font-lock-extend-after-change-region-function)
(font-lock-extend-region-functions, font-lock-major-mode):
* lisp/menu-bar.el (list-buffers-directory):
* lisp/simple.el (next-error--message-highlight-overlay)
(next-error-buffer, next-error-function)
(next-error-move-function, goto-line-history)
(minibuffer-default-add-done, undo-extra-outer-limit):
* lisp/tab-bar.el (tab-switcher-column):
* lisp/term/ns-win.el (ns-select-overlay):
* lisp/window.el (window-size-fixed, window-area-factor)
(window-group-start-function, window-group-end-function)
(set-window-group-start-function)
(recenter-window-group-function)
(pos-visible-in-window-group-p-function)
(selected-window-group-function)
(move-to-window-group-line-function): Prefer defvar-local.
2021-01-31 18:46:20 +00:00
|
|
|
|
(defvar-local mode-line-modified
|
2000-01-07 14:16:07 +00:00
|
|
|
|
(list (propertize
|
2000-07-18 21:53:46 +00:00
|
|
|
|
"%1*"
|
2012-06-03 10:23:49 +00:00
|
|
|
|
'help-echo 'mode-line-read-only-help-echo
|
2001-08-09 14:06:54 +00:00
|
|
|
|
'local-map (purecopy (make-mode-line-mouse-map
|
2005-09-15 04:12:27 +00:00
|
|
|
|
'mouse-1
|
2005-05-23 11:19:17 +00:00
|
|
|
|
#'mode-line-toggle-read-only))
|
|
|
|
|
'mouse-face 'mode-line-highlight)
|
2000-07-18 21:53:46 +00:00
|
|
|
|
(propertize
|
|
|
|
|
"%1+"
|
2012-06-03 10:23:49 +00:00
|
|
|
|
'help-echo 'mode-line-modified-help-echo
|
2001-08-09 14:06:54 +00:00
|
|
|
|
'local-map (purecopy (make-mode-line-mouse-map
|
2005-09-15 04:12:27 +00:00
|
|
|
|
'mouse-1 #'mode-line-toggle-modified))
|
2005-05-23 11:19:17 +00:00
|
|
|
|
'mouse-face 'mode-line-highlight))
|
2012-06-03 09:03:23 +00:00
|
|
|
|
"Mode line construct for displaying whether current buffer is modified.")
|
2009-10-15 06:18:02 +00:00
|
|
|
|
;;;###autoload
|
2009-08-26 03:07:25 +00:00
|
|
|
|
(put 'mode-line-modified 'risky-local-variable t)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
Prefer defvar-local in preloaded files
* lisp/abbrev.el:
* lisp/bindings.el (mode-line-mule-info, mode-line-modified)
(mode-line-remote, mode-line-process)
(mode-line-buffer-identification):
* lisp/buff-menu.el (Buffer-menu-files-only):
* lisp/files.el (buffer-file-number, buffer-file-read-only)
(local-write-file-hooks, write-contents-functions)
(file-local-variables-alist, dir-local-variables-alist)
(save-buffer-coding-system, buffer-save-without-query):
* lisp/font-core.el (font-lock-defaults):
* lisp/font-lock.el (font-lock-keywords-case-fold-search)
(font-lock-syntactically-fontified)
(font-lock-extend-after-change-region-function)
(font-lock-extend-region-functions, font-lock-major-mode):
* lisp/menu-bar.el (list-buffers-directory):
* lisp/simple.el (next-error--message-highlight-overlay)
(next-error-buffer, next-error-function)
(next-error-move-function, goto-line-history)
(minibuffer-default-add-done, undo-extra-outer-limit):
* lisp/tab-bar.el (tab-switcher-column):
* lisp/term/ns-win.el (ns-select-overlay):
* lisp/window.el (window-size-fixed, window-area-factor)
(window-group-start-function, window-group-end-function)
(set-window-group-start-function)
(recenter-window-group-function)
(pos-visible-in-window-group-p-function)
(selected-window-group-function)
(move-to-window-group-line-function): Prefer defvar-local.
2021-01-31 18:46:20 +00:00
|
|
|
|
(defvar-local mode-line-remote
|
2007-07-22 23:10:30 +00:00
|
|
|
|
(list (propertize
|
2007-07-28 01:24:33 +00:00
|
|
|
|
"%1@"
|
2008-03-05 04:09:24 +00:00
|
|
|
|
'mouse-face 'mode-line-highlight
|
2011-04-19 13:44:55 +00:00
|
|
|
|
'help-echo (purecopy (lambda (window _object _point)
|
2007-07-22 23:10:30 +00:00
|
|
|
|
(format "%s"
|
2012-10-09 06:41:07 +00:00
|
|
|
|
(with-selected-window window
|
2014-07-13 14:49:59 +00:00
|
|
|
|
(if (stringp default-directory)
|
|
|
|
|
(concat
|
|
|
|
|
(if (file-remote-p default-directory)
|
|
|
|
|
"Current directory is remote: "
|
|
|
|
|
"Current directory is local: ")
|
|
|
|
|
default-directory)
|
|
|
|
|
"Current directory is nil")))))))
|
2012-06-03 09:03:23 +00:00
|
|
|
|
"Mode line construct to indicate a remote buffer.")
|
2009-10-15 06:18:02 +00:00
|
|
|
|
;;;###autoload
|
2009-08-26 03:07:25 +00:00
|
|
|
|
(put 'mode-line-remote 'risky-local-variable t)
|
2007-07-22 23:10:30 +00:00
|
|
|
|
|
2012-06-03 09:03:23 +00:00
|
|
|
|
;; MSDOS frames have window-system, but want the Fn identification.
|
|
|
|
|
(defun mode-line-frame-control ()
|
|
|
|
|
"Compute mode line construct for frame identification.
|
|
|
|
|
Value is used for `mode-line-frame-identification', which see."
|
|
|
|
|
(if (or (null window-system)
|
|
|
|
|
(eq window-system 'pc))
|
|
|
|
|
"-%F "
|
|
|
|
|
" "))
|
|
|
|
|
|
|
|
|
|
;; We need to defer the call to mode-line-frame-control to the time
|
|
|
|
|
;; the mode line is actually displayed.
|
|
|
|
|
(defvar mode-line-frame-identification '(:eval (mode-line-frame-control))
|
|
|
|
|
"Mode line construct to describe the current frame.")
|
2009-10-15 06:18:02 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 09:03:23 +00:00
|
|
|
|
(put 'mode-line-frame-identification 'risky-local-variable t)
|
2001-10-31 21:57:45 +00:00
|
|
|
|
|
Prefer defvar-local in preloaded files
* lisp/abbrev.el:
* lisp/bindings.el (mode-line-mule-info, mode-line-modified)
(mode-line-remote, mode-line-process)
(mode-line-buffer-identification):
* lisp/buff-menu.el (Buffer-menu-files-only):
* lisp/files.el (buffer-file-number, buffer-file-read-only)
(local-write-file-hooks, write-contents-functions)
(file-local-variables-alist, dir-local-variables-alist)
(save-buffer-coding-system, buffer-save-without-query):
* lisp/font-core.el (font-lock-defaults):
* lisp/font-lock.el (font-lock-keywords-case-fold-search)
(font-lock-syntactically-fontified)
(font-lock-extend-after-change-region-function)
(font-lock-extend-region-functions, font-lock-major-mode):
* lisp/menu-bar.el (list-buffers-directory):
* lisp/simple.el (next-error--message-highlight-overlay)
(next-error-buffer, next-error-function)
(next-error-move-function, goto-line-history)
(minibuffer-default-add-done, undo-extra-outer-limit):
* lisp/tab-bar.el (tab-switcher-column):
* lisp/term/ns-win.el (ns-select-overlay):
* lisp/window.el (window-size-fixed, window-area-factor)
(window-group-start-function, window-group-end-function)
(set-window-group-start-function)
(recenter-window-group-function)
(pos-visible-in-window-group-p-function)
(selected-window-group-function)
(move-to-window-group-line-function): Prefer defvar-local.
2021-01-31 18:46:20 +00:00
|
|
|
|
(defvar-local mode-line-process nil
|
2012-06-03 09:03:23 +00:00
|
|
|
|
"Mode line construct for displaying info on process status.
|
|
|
|
|
Normally nil in most modes, since there is no process to display.")
|
2009-10-15 06:18:02 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 09:03:23 +00:00
|
|
|
|
(put 'mode-line-process 'risky-local-variable t)
|
2001-10-31 21:57:45 +00:00
|
|
|
|
|
2012-06-27 21:15:13 +00:00
|
|
|
|
(defun bindings--define-key (map key item)
|
2018-10-01 07:19:27 +00:00
|
|
|
|
"Define KEY in keymap MAP according to ITEM from a menu.
|
|
|
|
|
This is like `define-key', but it takes the definition from the
|
|
|
|
|
specified menu item, and makes pure copies of as much as possible
|
|
|
|
|
of the menu's data."
|
2012-06-27 21:15:13 +00:00
|
|
|
|
(declare (indent 2))
|
|
|
|
|
(define-key map key
|
|
|
|
|
(cond
|
|
|
|
|
((not (consp item)) item) ;Not sure that could be other than a symbol.
|
|
|
|
|
;; Keymaps can't be made pure otherwise users can't remove/add elements
|
|
|
|
|
;; from/to them any more.
|
|
|
|
|
((keymapp item) item)
|
|
|
|
|
((stringp (car item))
|
|
|
|
|
(if (keymapp (cdr item))
|
|
|
|
|
(cons (purecopy (car item)) (cdr item))
|
|
|
|
|
(purecopy item)))
|
|
|
|
|
((eq 'menu-item (car item))
|
|
|
|
|
(if (keymapp (nth 2 item))
|
|
|
|
|
`(menu-item ,(purecopy (nth 1 item)) ,(nth 2 item)
|
|
|
|
|
,@(purecopy (nthcdr 3 item)))
|
|
|
|
|
(purecopy item)))
|
|
|
|
|
(t (message "non-menu-item: %S" item) item))))
|
|
|
|
|
|
2008-04-01 07:56:11 +00:00
|
|
|
|
(defvar mode-line-mode-menu (make-sparse-keymap "Minor Modes") "\
|
|
|
|
|
Menu of mode operations in the mode line.")
|
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(defvar mode-line-major-mode-keymap
|
2003-04-12 17:28:24 +00:00
|
|
|
|
(let ((map (make-sparse-keymap)))
|
2012-06-27 21:15:13 +00:00
|
|
|
|
(bindings--define-key map [mode-line down-mouse-1]
|
|
|
|
|
`(menu-item "Menu Bar" ignore
|
|
|
|
|
:filter ,(lambda (_) (mouse-menu-major-mode-map))))
|
2003-04-12 17:28:24 +00:00
|
|
|
|
(define-key map [mode-line mouse-2] 'describe-mode)
|
2008-04-01 07:56:11 +00:00
|
|
|
|
(define-key map [mode-line down-mouse-3] mode-line-mode-menu)
|
2003-04-12 17:28:24 +00:00
|
|
|
|
map) "\
|
2003-03-31 20:24:56 +00:00
|
|
|
|
Keymap to display on major mode.")
|
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(defvar mode-line-minor-mode-keymap
|
2003-04-12 17:28:24 +00:00
|
|
|
|
(let ((map (make-sparse-keymap)))
|
2007-10-18 04:08:42 +00:00
|
|
|
|
(define-key map [mode-line down-mouse-1] 'mouse-minor-mode-menu)
|
2003-04-12 17:28:24 +00:00
|
|
|
|
(define-key map [mode-line mouse-2] 'mode-line-minor-mode-help)
|
2008-04-01 07:56:11 +00:00
|
|
|
|
(define-key map [mode-line down-mouse-3] mode-line-mode-menu)
|
|
|
|
|
(define-key map [header-line down-mouse-3] mode-line-mode-menu)
|
2003-04-12 17:28:24 +00:00
|
|
|
|
map) "\
|
2003-03-31 20:24:56 +00:00
|
|
|
|
Keymap to display on minor modes.")
|
|
|
|
|
|
2012-06-03 09:03:23 +00:00
|
|
|
|
(defvar mode-line-modes
|
|
|
|
|
(let ((recursive-edit-help-echo "Recursive edit, type C-M-c to get out"))
|
|
|
|
|
(list (propertize "%[" 'help-echo recursive-edit-help-echo)
|
|
|
|
|
"("
|
|
|
|
|
`(:propertize ("" mode-name)
|
|
|
|
|
help-echo "Major mode\n\
|
|
|
|
|
mouse-1: Display major mode menu\n\
|
|
|
|
|
mouse-2: Show help for major mode\n\
|
|
|
|
|
mouse-3: Toggle minor modes"
|
|
|
|
|
mouse-face mode-line-highlight
|
|
|
|
|
local-map ,mode-line-major-mode-keymap)
|
|
|
|
|
'("" mode-line-process)
|
|
|
|
|
`(:propertize ("" minor-mode-alist)
|
|
|
|
|
mouse-face mode-line-highlight
|
|
|
|
|
help-echo "Minor mode\n\
|
|
|
|
|
mouse-1: Display minor mode menu\n\
|
|
|
|
|
mouse-2: Show help for minor mode\n\
|
|
|
|
|
mouse-3: Toggle minor modes"
|
|
|
|
|
local-map ,mode-line-minor-mode-keymap)
|
2012-06-03 10:23:49 +00:00
|
|
|
|
(propertize "%n" 'help-echo "mouse-2: Remove narrowing from buffer"
|
2012-06-03 09:03:23 +00:00
|
|
|
|
'mouse-face 'mode-line-highlight
|
|
|
|
|
'local-map (make-mode-line-mouse-map
|
|
|
|
|
'mouse-2 #'mode-line-widen))
|
|
|
|
|
")"
|
|
|
|
|
(propertize "%]" 'help-echo recursive-edit-help-echo)
|
|
|
|
|
" "))
|
|
|
|
|
"Mode line construct for displaying major and minor modes.")
|
|
|
|
|
(put 'mode-line-modes 'risky-local-variable t)
|
|
|
|
|
|
2008-03-03 08:30:18 +00:00
|
|
|
|
(defvar mode-line-column-line-number-mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap))
|
|
|
|
|
(menu-map (make-sparse-keymap "Toggle Line and Column Number Display")))
|
2016-05-01 17:42:35 +00:00
|
|
|
|
(bindings--define-key menu-map [size-indication-mode]
|
|
|
|
|
'(menu-item "Display Size Indication" size-indication-mode
|
|
|
|
|
:help "Toggle displaying a size indication in the mode-line"
|
|
|
|
|
:button (:toggle . size-indication-mode)))
|
2012-06-27 21:15:13 +00:00
|
|
|
|
(bindings--define-key menu-map [line-number-mode]
|
|
|
|
|
'(menu-item "Display Line Numbers" line-number-mode
|
|
|
|
|
:help "Toggle displaying line numbers in the mode-line"
|
2008-03-03 08:30:18 +00:00
|
|
|
|
:button (:toggle . line-number-mode)))
|
2012-06-27 21:15:13 +00:00
|
|
|
|
(bindings--define-key menu-map [column-number-mode]
|
|
|
|
|
'(menu-item "Display Column Numbers" column-number-mode
|
|
|
|
|
:help "Toggle displaying column numbers in the mode-line"
|
2008-03-03 08:30:18 +00:00
|
|
|
|
:button (:toggle . column-number-mode)))
|
|
|
|
|
(define-key map [mode-line down-mouse-1] menu-map)
|
|
|
|
|
map) "\
|
|
|
|
|
Keymap to display on column and line numbers.")
|
|
|
|
|
|
2017-05-10 17:57:21 +00:00
|
|
|
|
(defcustom column-number-indicator-zero-based t
|
|
|
|
|
"When non-nil, mode line displays column numbers zero-based.
|
|
|
|
|
|
|
|
|
|
This variable has effect only when Column Number mode is turned on,
|
|
|
|
|
which displays column numbers in the mode line.
|
|
|
|
|
If the value is non-nil, the displayed column numbers start from
|
|
|
|
|
zero, otherwise they start from one."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'mode-line
|
|
|
|
|
:version "26.1")
|
2020-09-17 14:09:30 +00:00
|
|
|
|
(make-obsolete-variable 'column-number-indicator-zero-based
|
|
|
|
|
'mode-line-position-column-format "28.1")
|
2017-05-10 17:57:21 +00:00
|
|
|
|
|
2017-05-21 10:16:09 +00:00
|
|
|
|
(defcustom mode-line-percent-position '(-3 "%p")
|
2017-06-13 05:31:53 +00:00
|
|
|
|
"Specification of \"percentage offset\" of window through buffer.
|
2017-05-21 10:16:09 +00:00
|
|
|
|
This option specifies both the field width and the type of offset
|
|
|
|
|
displayed in `mode-line-position', a component of the default
|
|
|
|
|
`mode-line-format'."
|
2018-11-05 00:22:15 +00:00
|
|
|
|
:type '(radio
|
2017-05-21 10:16:09 +00:00
|
|
|
|
(const :tag "nil: No offset is displayed" nil)
|
|
|
|
|
(const :tag "\"%o\": Proportion of \"travel\" of the window through the buffer"
|
|
|
|
|
(-3 "%o"))
|
|
|
|
|
(const :tag "\"%p\": Percentage offset of top of window"
|
|
|
|
|
(-3 "%p"))
|
2017-05-21 20:41:43 +00:00
|
|
|
|
(const :tag "\"%P\": Percentage offset of bottom of window"
|
2017-05-21 10:16:09 +00:00
|
|
|
|
(-3 "%P"))
|
|
|
|
|
(const :tag "\"%q\": Offsets of both top and bottom of window"
|
|
|
|
|
(6 "%q")))
|
|
|
|
|
:version "26.1"
|
|
|
|
|
:group 'mode-line)
|
2017-05-30 16:21:31 +00:00
|
|
|
|
(put 'mode-line-percent-position 'risky-local-variable t)
|
2017-05-21 10:16:09 +00:00
|
|
|
|
|
2020-09-20 19:43:01 +00:00
|
|
|
|
(defcustom mode-line-position-line-format '(" L%l")
|
2020-09-15 15:07:31 +00:00
|
|
|
|
"Format used to display line numbers in the mode line.
|
|
|
|
|
This is used when `line-number-mode' is switched on. The \"%l\"
|
|
|
|
|
format spec will be replaced by the line number."
|
2020-09-20 19:43:01 +00:00
|
|
|
|
:type '(list string)
|
2020-09-15 15:07:31 +00:00
|
|
|
|
:version "28.1"
|
|
|
|
|
:group 'mode-line)
|
|
|
|
|
|
2020-09-20 19:43:01 +00:00
|
|
|
|
(defcustom mode-line-position-column-format '(" C%c")
|
2020-09-15 15:07:31 +00:00
|
|
|
|
"Format used to display column numbers in the mode line.
|
|
|
|
|
This is used when `column-number-mode' is switched on. The
|
|
|
|
|
\"%c\" format spec will be replaced by the column number, which
|
|
|
|
|
is zero-based if `column-number-indicator-zero-based' is non-nil,
|
2020-09-17 18:48:29 +00:00
|
|
|
|
and one-based if `column-number-indicator-zero-based' is nil."
|
2020-09-20 19:43:01 +00:00
|
|
|
|
:type '(list string)
|
2020-09-15 15:07:31 +00:00
|
|
|
|
:version "28.1"
|
|
|
|
|
:group 'mode-line)
|
|
|
|
|
|
2020-09-20 19:43:01 +00:00
|
|
|
|
(defcustom mode-line-position-column-line-format '(" (%l,%c)")
|
2020-09-17 14:09:30 +00:00
|
|
|
|
"Format used to display combined line/column numbers in the mode line.
|
|
|
|
|
This is used when `column-number-mode' and `line-number-mode' are
|
|
|
|
|
switched on. The \"%c\" format spec will be replaced by the
|
|
|
|
|
column number, which is zero-based if
|
|
|
|
|
`column-number-indicator-zero-based' is non-nil, and one-based if
|
|
|
|
|
`column-number-indicator-zero-based' is nil."
|
2020-09-20 19:43:01 +00:00
|
|
|
|
:type '(list string)
|
2020-09-17 14:09:30 +00:00
|
|
|
|
:version "28.1"
|
|
|
|
|
:group 'mode-line)
|
|
|
|
|
|
|
|
|
|
(defconst mode-line-position--column-line-properties
|
|
|
|
|
(list 'local-map mode-line-column-line-number-mode-map
|
|
|
|
|
'mouse-face 'mode-line-highlight
|
|
|
|
|
'help-echo "Line number and Column number\n\
|
|
|
|
|
mouse-1: Display Line and Column Mode Menu"))
|
|
|
|
|
|
2012-06-03 09:03:23 +00:00
|
|
|
|
(defvar mode-line-position
|
2017-05-21 10:16:09 +00:00
|
|
|
|
`((:propertize
|
|
|
|
|
mode-line-percent-position
|
2017-05-30 16:21:31 +00:00
|
|
|
|
local-map ,mode-line-column-line-number-mode-map
|
|
|
|
|
mouse-face mode-line-highlight
|
2017-05-21 10:16:09 +00:00
|
|
|
|
;; XXX needs better description
|
2017-05-30 16:21:31 +00:00
|
|
|
|
help-echo "Size indication mode\n\
|
2017-05-21 10:16:09 +00:00
|
|
|
|
mouse-1: Display Line and Column Mode Menu")
|
2012-06-03 09:03:23 +00:00
|
|
|
|
(size-indication-mode
|
|
|
|
|
(8 ,(propertize
|
|
|
|
|
" of %I"
|
|
|
|
|
'local-map mode-line-column-line-number-mode-map
|
|
|
|
|
'mouse-face 'mode-line-highlight
|
|
|
|
|
;; XXX needs better description
|
|
|
|
|
'help-echo "Size indication mode\n\
|
2008-03-03 08:30:18 +00:00
|
|
|
|
mouse-1: Display Line and Column Mode Menu")))
|
2012-06-03 09:03:23 +00:00
|
|
|
|
(line-number-mode
|
|
|
|
|
((column-number-mode
|
2017-05-10 17:57:21 +00:00
|
|
|
|
(column-number-indicator-zero-based
|
2020-09-20 19:43:01 +00:00
|
|
|
|
(10
|
|
|
|
|
(:propertize
|
|
|
|
|
mode-line-position-column-line-format
|
|
|
|
|
,@mode-line-position--column-line-properties))
|
|
|
|
|
(10
|
|
|
|
|
(:propertize
|
2020-09-26 22:24:50 +00:00
|
|
|
|
(:eval (string-replace
|
2020-09-20 19:43:01 +00:00
|
|
|
|
"%c" "%C" (car mode-line-position-column-line-format)))
|
|
|
|
|
,@mode-line-position--column-line-properties)))
|
|
|
|
|
(6
|
|
|
|
|
(:propertize
|
|
|
|
|
mode-line-position-line-format
|
|
|
|
|
,@mode-line-position--column-line-properties))))
|
2020-09-17 14:09:30 +00:00
|
|
|
|
(column-number-mode
|
|
|
|
|
(column-number-indicator-zero-based
|
2020-09-20 19:43:01 +00:00
|
|
|
|
(6
|
|
|
|
|
(:propertize
|
|
|
|
|
mode-line-position-column-format
|
|
|
|
|
(,@mode-line-position--column-line-properties)))
|
|
|
|
|
(6
|
|
|
|
|
(:propertize
|
2020-09-26 22:24:50 +00:00
|
|
|
|
(:eval (string-replace
|
2020-09-20 19:43:01 +00:00
|
|
|
|
"%c" "%C" (car mode-line-position-column-format)))
|
|
|
|
|
,@mode-line-position--column-line-properties))))))
|
2012-06-03 09:03:23 +00:00
|
|
|
|
"Mode line construct for displaying the position in the buffer.
|
|
|
|
|
Normally displays the buffer percentage and, optionally, the
|
|
|
|
|
buffer size, the line number and the column number.")
|
|
|
|
|
(put 'mode-line-position 'risky-local-variable t)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
2006-09-11 07:11:21 +00:00
|
|
|
|
(defvar mode-line-buffer-identification-keymap
|
|
|
|
|
;; Add menu of buffer operations to the buffer identification part
|
|
|
|
|
;; of the mode line.or header line.
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
;; Bind down- events so that the global keymap won't ``shine
|
|
|
|
|
;; through''.
|
|
|
|
|
(define-key map [mode-line mouse-1] 'mode-line-previous-buffer)
|
|
|
|
|
(define-key map [header-line down-mouse-1] 'ignore)
|
|
|
|
|
(define-key map [header-line mouse-1] 'mode-line-previous-buffer)
|
|
|
|
|
(define-key map [mode-line mouse-3] 'mode-line-next-buffer)
|
|
|
|
|
(define-key map [header-line down-mouse-3] 'ignore)
|
|
|
|
|
(define-key map [header-line mouse-3] 'mode-line-next-buffer)
|
|
|
|
|
map) "\
|
1999-09-04 11:29:26 +00:00
|
|
|
|
Keymap for what is displayed by `mode-line-buffer-identification'.")
|
1999-07-21 21:43:03 +00:00
|
|
|
|
|
2006-07-29 02:07:22 +00:00
|
|
|
|
(defun propertized-buffer-identification (fmt)
|
|
|
|
|
"Return a list suitable for `mode-line-buffer-identification'.
|
|
|
|
|
FMT is a format specifier such as \"%12b\". This function adds
|
|
|
|
|
text properties for face, help-echo, and local-map to it."
|
2009-10-23 07:29:21 +00:00
|
|
|
|
(list (propertize fmt
|
2006-07-29 02:07:22 +00:00
|
|
|
|
'face 'mode-line-buffer-id
|
|
|
|
|
'help-echo
|
2012-06-03 10:23:49 +00:00
|
|
|
|
(purecopy "Buffer name
|
|
|
|
|
mouse-1: Previous buffer\nmouse-3: Next buffer")
|
2006-07-29 02:07:22 +00:00
|
|
|
|
'mouse-face 'mode-line-highlight
|
|
|
|
|
'local-map mode-line-buffer-identification-keymap)))
|
|
|
|
|
|
Prefer defvar-local in preloaded files
* lisp/abbrev.el:
* lisp/bindings.el (mode-line-mule-info, mode-line-modified)
(mode-line-remote, mode-line-process)
(mode-line-buffer-identification):
* lisp/buff-menu.el (Buffer-menu-files-only):
* lisp/files.el (buffer-file-number, buffer-file-read-only)
(local-write-file-hooks, write-contents-functions)
(file-local-variables-alist, dir-local-variables-alist)
(save-buffer-coding-system, buffer-save-without-query):
* lisp/font-core.el (font-lock-defaults):
* lisp/font-lock.el (font-lock-keywords-case-fold-search)
(font-lock-syntactically-fontified)
(font-lock-extend-after-change-region-function)
(font-lock-extend-region-functions, font-lock-major-mode):
* lisp/menu-bar.el (list-buffers-directory):
* lisp/simple.el (next-error--message-highlight-overlay)
(next-error-buffer, next-error-function)
(next-error-move-function, goto-line-history)
(minibuffer-default-add-done, undo-extra-outer-limit):
* lisp/tab-bar.el (tab-switcher-column):
* lisp/term/ns-win.el (ns-select-overlay):
* lisp/window.el (window-size-fixed, window-area-factor)
(window-group-start-function, window-group-end-function)
(set-window-group-start-function)
(recenter-window-group-function)
(pos-visible-in-window-group-p-function)
(selected-window-group-function)
(move-to-window-group-line-function): Prefer defvar-local.
2021-01-31 18:46:20 +00:00
|
|
|
|
(defvar-local mode-line-buffer-identification
|
2012-06-03 09:03:23 +00:00
|
|
|
|
(propertized-buffer-identification "%12b")
|
|
|
|
|
"Mode line construct for identifying the buffer being displayed.
|
2006-07-29 02:07:22 +00:00
|
|
|
|
Its default value is (\"%12b\") with some text properties added.
|
|
|
|
|
Major modes that edit things other than ordinary files may change this
|
|
|
|
|
\(e.g. Info, Dired,...)")
|
2009-10-15 06:18:02 +00:00
|
|
|
|
;;;###autoload
|
2009-08-26 03:07:25 +00:00
|
|
|
|
(put 'mode-line-buffer-identification 'risky-local-variable t)
|
2006-07-29 02:07:22 +00:00
|
|
|
|
|
2012-06-03 09:03:23 +00:00
|
|
|
|
(defvar mode-line-misc-info
|
2015-11-30 15:52:12 +00:00
|
|
|
|
'((global-mode-string ("" global-mode-string " ")))
|
2012-06-03 09:03:23 +00:00
|
|
|
|
"Mode line construct for miscellaneous information.
|
2015-11-30 15:52:12 +00:00
|
|
|
|
By default, this shows the information specified by `global-mode-string'.")
|
2012-06-03 09:03:23 +00:00
|
|
|
|
(put 'mode-line-misc-info 'risky-local-variable t)
|
|
|
|
|
|
|
|
|
|
(defvar mode-line-end-spaces '(:eval (unless (display-graphic-p) "-%-"))
|
|
|
|
|
"Mode line construct to put at the end of the mode line.")
|
|
|
|
|
(put 'mode-line-end-spaces 'risky-local-variable t)
|
|
|
|
|
|
|
|
|
|
;; Default value of the top-level `mode-line-format' variable:
|
|
|
|
|
(let ((standard-mode-line-format
|
|
|
|
|
(list "%e"
|
|
|
|
|
'mode-line-front-space
|
|
|
|
|
'mode-line-mule-info
|
|
|
|
|
'mode-line-client
|
|
|
|
|
'mode-line-modified
|
|
|
|
|
'mode-line-remote
|
|
|
|
|
'mode-line-frame-identification
|
|
|
|
|
'mode-line-buffer-identification
|
|
|
|
|
" "
|
|
|
|
|
'mode-line-position
|
|
|
|
|
'(vc-mode vc-mode)
|
|
|
|
|
" "
|
|
|
|
|
'mode-line-modes
|
|
|
|
|
'mode-line-misc-info
|
|
|
|
|
'mode-line-end-spaces)))
|
|
|
|
|
(setq-default mode-line-format standard-mode-line-format)
|
|
|
|
|
(put 'mode-line-format 'standard-value
|
|
|
|
|
(list `(quote ,standard-mode-line-format))))
|
|
|
|
|
|
|
|
|
|
|
2001-08-22 08:54:43 +00:00
|
|
|
|
(defun mode-line-unbury-buffer (event) "\
|
2001-11-19 16:32:37 +00:00
|
|
|
|
Call `unbury-buffer' in this window."
|
2001-08-22 08:54:43 +00:00
|
|
|
|
(interactive "e")
|
2012-10-09 06:41:07 +00:00
|
|
|
|
(with-selected-window (posn-window (event-start event))
|
2001-11-19 16:32:37 +00:00
|
|
|
|
(unbury-buffer)))
|
2001-08-22 08:54:43 +00:00
|
|
|
|
|
|
|
|
|
(defun mode-line-bury-buffer (event) "\
|
2001-11-25 05:38:00 +00:00
|
|
|
|
Like `bury-buffer', but temporarily select EVENT's window."
|
2001-08-22 08:54:43 +00:00
|
|
|
|
(interactive "e")
|
2012-10-09 06:41:07 +00:00
|
|
|
|
(with-selected-window (posn-window (event-start event))
|
2001-08-22 08:54:43 +00:00
|
|
|
|
(bury-buffer)))
|
1999-07-21 21:43:03 +00:00
|
|
|
|
|
1999-09-04 11:29:26 +00:00
|
|
|
|
(defun mode-line-other-buffer () "\
|
|
|
|
|
Switch to the most recently selected buffer other than the current one."
|
1999-07-21 21:43:03 +00:00
|
|
|
|
(interactive)
|
2011-07-14 01:40:30 +00:00
|
|
|
|
(switch-to-buffer (other-buffer) nil t))
|
1999-07-21 21:43:03 +00:00
|
|
|
|
|
2006-01-16 23:50:39 +00:00
|
|
|
|
(defun mode-line-next-buffer (event)
|
|
|
|
|
"Like `next-buffer', but temporarily select EVENT's window."
|
|
|
|
|
(interactive "e")
|
2012-10-09 06:41:07 +00:00
|
|
|
|
(with-selected-window (posn-window (event-start event))
|
2006-01-16 23:50:39 +00:00
|
|
|
|
(next-buffer)))
|
|
|
|
|
|
|
|
|
|
(defun mode-line-previous-buffer (event)
|
|
|
|
|
"Like `previous-buffer', but temporarily select EVENT's window."
|
|
|
|
|
(interactive "e")
|
2012-10-09 06:41:07 +00:00
|
|
|
|
(with-selected-window (posn-window (event-start event))
|
2006-01-16 23:50:39 +00:00
|
|
|
|
(previous-buffer)))
|
|
|
|
|
|
1999-10-07 14:13:29 +00:00
|
|
|
|
(defmacro bound-and-true-p (var)
|
|
|
|
|
"Return the value of symbol VAR if it is bound, else nil."
|
1999-10-17 10:48:08 +00:00
|
|
|
|
`(and (boundp (quote ,var)) ,var))
|
1999-10-07 14:13:29 +00:00
|
|
|
|
|
2006-10-25 20:05:53 +00:00
|
|
|
|
;; Use mode-line-mode-menu for local minor-modes only.
|
|
|
|
|
;; Global ones can go on the menubar (Options --> Show/Hide).
|
2012-06-27 21:15:13 +00:00
|
|
|
|
(bindings--define-key mode-line-mode-menu [overwrite-mode]
|
|
|
|
|
'(menu-item "Overwrite (Ovwrt)" overwrite-mode
|
|
|
|
|
:help "Overwrite mode: typed characters replace existing text"
|
2000-01-07 14:16:07 +00:00
|
|
|
|
:button (:toggle . overwrite-mode)))
|
2012-06-27 21:15:13 +00:00
|
|
|
|
(bindings--define-key mode-line-mode-menu [outline-minor-mode]
|
|
|
|
|
'(menu-item "Outline (Outl)" outline-minor-mode
|
2008-02-15 22:45:03 +00:00
|
|
|
|
;; XXX: This needs a good, brief description.
|
2012-06-27 21:15:13 +00:00
|
|
|
|
:help ""
|
2000-12-07 13:22:12 +00:00
|
|
|
|
:button (:toggle . (bound-and-true-p outline-minor-mode))))
|
2012-06-27 21:15:13 +00:00
|
|
|
|
(bindings--define-key mode-line-mode-menu [highlight-changes-mode]
|
|
|
|
|
'(menu-item "Highlight changes (Chg)" highlight-changes-mode
|
|
|
|
|
:help "Show changes in the buffer in a distinctive color"
|
2005-01-17 21:18:35 +00:00
|
|
|
|
:button (:toggle . (bound-and-true-p highlight-changes-mode))))
|
2012-06-27 21:15:13 +00:00
|
|
|
|
(bindings--define-key mode-line-mode-menu [hide-ifdef-mode]
|
|
|
|
|
'(menu-item "Hide ifdef (Ifdef)" hide-ifdef-mode
|
|
|
|
|
:help "Show/Hide code within #ifdef constructs"
|
2000-12-07 13:22:12 +00:00
|
|
|
|
:button (:toggle . (bound-and-true-p hide-ifdef-mode))))
|
2012-06-27 21:15:13 +00:00
|
|
|
|
(bindings--define-key mode-line-mode-menu [glasses-mode]
|
|
|
|
|
'(menu-item "Glasses (o^o)" glasses-mode
|
|
|
|
|
:help "Insert virtual separators to make long identifiers easy to read"
|
2004-07-14 21:09:33 +00:00
|
|
|
|
:button (:toggle . (bound-and-true-p glasses-mode))))
|
2012-06-27 21:15:13 +00:00
|
|
|
|
(bindings--define-key mode-line-mode-menu [font-lock-mode]
|
|
|
|
|
'(menu-item "Font Lock" font-lock-mode
|
|
|
|
|
:help "Syntax coloring"
|
2000-12-07 13:22:12 +00:00
|
|
|
|
:button (:toggle . font-lock-mode)))
|
2012-06-27 21:15:13 +00:00
|
|
|
|
(bindings--define-key mode-line-mode-menu [flyspell-mode]
|
|
|
|
|
'(menu-item "Flyspell (Fly)" flyspell-mode
|
|
|
|
|
:help "Spell checking on the fly"
|
2000-12-07 13:22:12 +00:00
|
|
|
|
:button (:toggle . (bound-and-true-p flyspell-mode))))
|
2012-06-27 21:15:13 +00:00
|
|
|
|
(bindings--define-key mode-line-mode-menu [auto-revert-tail-mode]
|
|
|
|
|
'(menu-item "Auto revert tail (Tail)" auto-revert-tail-mode
|
2018-02-12 10:10:17 +00:00
|
|
|
|
:help "Revert the tail of the buffer when the file on disk grows"
|
2006-10-21 23:42:21 +00:00
|
|
|
|
:enable (buffer-file-name)
|
2005-01-17 21:18:35 +00:00
|
|
|
|
:button (:toggle . (bound-and-true-p auto-revert-tail-mode))))
|
2012-06-27 21:15:13 +00:00
|
|
|
|
(bindings--define-key mode-line-mode-menu [auto-revert-mode]
|
|
|
|
|
'(menu-item "Auto revert (ARev)" auto-revert-mode
|
|
|
|
|
:help "Revert the buffer when the file on disk changes"
|
2005-01-17 21:18:35 +00:00
|
|
|
|
:button (:toggle . (bound-and-true-p auto-revert-mode))))
|
2012-06-27 21:15:13 +00:00
|
|
|
|
(bindings--define-key mode-line-mode-menu [auto-fill-mode]
|
|
|
|
|
'(menu-item "Auto fill (Fill)" auto-fill-mode
|
|
|
|
|
:help "Automatically insert new lines"
|
2004-07-14 21:09:33 +00:00
|
|
|
|
:button (:toggle . auto-fill-function)))
|
2012-06-27 21:15:13 +00:00
|
|
|
|
(bindings--define-key mode-line-mode-menu [abbrev-mode]
|
|
|
|
|
'(menu-item "Abbrev (Abbrev)" abbrev-mode
|
|
|
|
|
:help "Automatically expand abbreviations"
|
2000-12-07 13:22:12 +00:00
|
|
|
|
:button (:toggle . abbrev-mode)))
|
2000-01-07 14:16:07 +00:00
|
|
|
|
|
2003-03-31 20:24:56 +00:00
|
|
|
|
(defun mode-line-minor-mode-help (event)
|
2007-10-18 04:08:42 +00:00
|
|
|
|
"Describe minor mode for EVENT on minor modes area of the mode line."
|
2003-03-31 20:24:56 +00:00
|
|
|
|
(interactive "@e")
|
|
|
|
|
(let ((indicator (car (nth 4 (car (cdr event))))))
|
|
|
|
|
(describe-minor-mode-from-indicator indicator)))
|
|
|
|
|
|
2019-07-30 20:35:42 +00:00
|
|
|
|
(defvar mode-line-defining-kbd-macro (propertize " Def" 'face 'font-lock-warning-face)
|
|
|
|
|
"String displayed in the mode line in keyboard macro recording mode.")
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(put 'mode-line-defining-kbd-macro 'risky-local-variable t)
|
|
|
|
|
|
2001-08-09 14:51:20 +00:00
|
|
|
|
(defvar minor-mode-alist nil "\
|
|
|
|
|
Alist saying how to show minor modes in the mode line.
|
|
|
|
|
Each element looks like (VARIABLE STRING);
|
2007-08-08 07:40:09 +00:00
|
|
|
|
STRING is included in the mode line if VARIABLE's value is non-nil.
|
2001-08-09 14:51:20 +00:00
|
|
|
|
|
2012-06-03 09:03:23 +00:00
|
|
|
|
Actually, STRING need not be a string; any mode-line construct is
|
|
|
|
|
okay. See `mode-line-format'.")
|
2009-10-15 06:18:02 +00:00
|
|
|
|
;;;###autoload
|
2009-08-26 03:07:25 +00:00
|
|
|
|
(put 'minor-mode-alist 'risky-local-variable t)
|
2019-07-30 20:35:42 +00:00
|
|
|
|
;; Don't use purecopy here--some people want to change these strings,
|
|
|
|
|
;; also string properties are lost when put into pure space.
|
2001-08-09 14:51:20 +00:00
|
|
|
|
(setq minor-mode-alist
|
2019-07-30 20:35:42 +00:00
|
|
|
|
'((abbrev-mode " Abbrev")
|
2008-04-09 03:53:48 +00:00
|
|
|
|
(overwrite-mode overwrite-mode)
|
|
|
|
|
(auto-fill-function " Fill")
|
|
|
|
|
;; not really a minor mode...
|
2019-07-30 20:35:42 +00:00
|
|
|
|
(defining-kbd-macro mode-line-defining-kbd-macro)))
|
2001-08-09 14:51:20 +00:00
|
|
|
|
|
1996-09-11 19:05:36 +00:00
|
|
|
|
;; These variables are used by autoloadable packages.
|
|
|
|
|
;; They are defined here so that they do not get overridden
|
|
|
|
|
;; by the loading of those packages.
|
|
|
|
|
|
|
|
|
|
;; Names in directory that end in one of these
|
|
|
|
|
;; are ignored in completion,
|
|
|
|
|
;; making it more likely you will get a unique match.
|
|
|
|
|
(setq completion-ignored-extensions
|
1996-12-29 18:59:24 +00:00
|
|
|
|
(append
|
2001-10-14 20:00:28 +00:00
|
|
|
|
(cond ((memq system-type '(ms-dos windows-nt))
|
2009-10-26 06:43:36 +00:00
|
|
|
|
(mapcar 'purecopy
|
2001-10-14 20:00:28 +00:00
|
|
|
|
'(".o" "~" ".bin" ".bak" ".obj" ".map" ".ico" ".pif" ".lnk"
|
2009-10-26 06:43:36 +00:00
|
|
|
|
".a" ".ln" ".blg" ".bbl" ".dll" ".drv" ".vxd" ".386")))
|
1996-12-29 18:59:24 +00:00
|
|
|
|
(t
|
2009-10-26 06:43:36 +00:00
|
|
|
|
(mapcar 'purecopy
|
2001-10-14 20:00:28 +00:00
|
|
|
|
'(".o" "~" ".bin" ".lbin" ".so"
|
2009-10-26 06:43:36 +00:00
|
|
|
|
".a" ".ln" ".blg" ".bbl"))))
|
|
|
|
|
(mapcar 'purecopy
|
1996-12-29 18:59:24 +00:00
|
|
|
|
'(".elc" ".lof"
|
|
|
|
|
".glo" ".idx" ".lot"
|
2009-01-29 08:53:37 +00:00
|
|
|
|
;; VCS metadata directories
|
|
|
|
|
".svn/" ".hg/" ".git/" ".bzr/" "CVS/" "_darcs/" "_MTN/"
|
1996-12-29 18:59:24 +00:00
|
|
|
|
;; TeX-related
|
2007-10-17 21:34:19 +00:00
|
|
|
|
".fmt" ".tfm"
|
1998-03-28 21:56:57 +00:00
|
|
|
|
;; Java compiled
|
|
|
|
|
".class"
|
2001-10-12 19:18:50 +00:00
|
|
|
|
;; CLISP
|
|
|
|
|
".fas" ".lib" ".mem"
|
1998-03-28 21:56:57 +00:00
|
|
|
|
;; CMUCL
|
1999-10-17 10:48:08 +00:00
|
|
|
|
".x86f" ".sparcf"
|
2011-07-13 13:39:23 +00:00
|
|
|
|
;; OpenMCL / Clozure CL
|
|
|
|
|
".dfsl" ".pfsl" ".d64fsl" ".p64fsl" ".lx64fsl" ".lx32fsl"
|
|
|
|
|
".dx64fsl" ".dx32fsl" ".fx64fsl" ".fx32fsl" ".sx64fsl"
|
|
|
|
|
".sx32fsl" ".wx64fsl" ".wx32fsl"
|
|
|
|
|
;; Other CL implementations (Allegro, LispWorks)
|
|
|
|
|
".fasl" ".ufsl" ".fsl" ".dxl"
|
2000-07-27 15:41:49 +00:00
|
|
|
|
;; Libtool
|
|
|
|
|
".lo" ".la"
|
2002-07-06 09:42:31 +00:00
|
|
|
|
;; Gettext
|
|
|
|
|
".gmo" ".mo"
|
1996-12-29 18:59:24 +00:00
|
|
|
|
;; Texinfo-related
|
2004-04-16 12:51:06 +00:00
|
|
|
|
;; This used to contain .log, but that's commonly used for log
|
|
|
|
|
;; files you do want to see, not just TeX stuff. -- fx
|
|
|
|
|
".toc" ".aux"
|
1996-12-29 18:59:24 +00:00
|
|
|
|
".cp" ".fn" ".ky" ".pg" ".tp" ".vr"
|
2004-06-12 10:16:10 +00:00
|
|
|
|
".cps" ".fns" ".kys" ".pgs" ".tps" ".vrs"
|
|
|
|
|
;; Python byte-compiled
|
2009-10-26 06:43:36 +00:00
|
|
|
|
".pyc" ".pyo"))))
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
2001-10-14 20:08:21 +00:00
|
|
|
|
;; Suffixes used for executables.
|
|
|
|
|
(setq exec-suffixes
|
|
|
|
|
(cond
|
|
|
|
|
((memq system-type '(ms-dos windows-nt))
|
|
|
|
|
'(".exe" ".com" ".bat" ".cmd" ".btm" ""))
|
|
|
|
|
(t
|
|
|
|
|
'(""))))
|
|
|
|
|
|
2000-03-12 15:19:44 +00:00
|
|
|
|
;; Packages should add to this list appropriately when they are
|
|
|
|
|
;; loaded, rather than listing everything here.
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(setq debug-ignored-errors
|
Add new error and function `user-error'.
* lisp/subr.el (user-error): New function.
* lisp/window.el (switch-to-buffer):
* lisp/vc/smerge-mode.el (smerge-resolve-function, smerge-resolve)
(smerge-match-conflict):
* lisp/simple.el (previous-matching-history-element)
(next-matching-history-element, goto-history-element, undo-more)
(undo-start):
* lisp/progmodes/etags.el (visit-tags-table-buffer, find-tag-tag)
(find-tag-noselect, find-tag-in-order, etags-goto-tag-location)
(next-file, tags-loop-scan, list-tags, complete-tag):
* lisp/progmodes/compile.el (compilation-loop):
* lisp/mouse.el (mouse-minibuffer-check):
* lisp/man.el (Man-bgproc-sentinel, Man-goto-page):
* lisp/info.el (Info-find-node-2, Info-extract-pointer, Info-history-back)
(Info-history-forward, Info-follow-reference, Info-menu)
(Info-extract-menu-item, Info-extract-menu-counting)
(Info-forward-node, Info-backward-node, Info-next-menu-item)
(Info-last-menu-item, Info-next-preorder, Info-last-preorder)
(Info-next-reference, Info-prev-reference, Info-index)
(Info-index-next, Info-follow-nearest-node)
(Info-copy-current-node-name):
* lisp/imenu.el (imenu--make-index-alist)
(imenu-default-create-index-function, imenu-add-to-menubar):
* lisp/files.el (basic-save-buffer, recover-file):
* lisp/emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
* lisp/emacs-lisp/checkdoc.el (checkdoc-continue, checkdoc-comments)
(checkdoc-message-text, checkdoc-defun):
* lisp/dabbrev.el (dabbrev-completion, dabbrev--abbrev-at-point):
* lisp/cus-edit.el (customize-changed-options, customize-rogue)
(customize-saved, custom-variable-set, custom-variable-mark-to-save)
(custom-variable-mark-to-reset-standard)
(custom-variable-reset-backup, custom-face-mark-to-reset-standard)
(custom-file):
* lisp/completion.el (check-completion-length):
* lisp/comint.el (comint-search-arg)
(comint-previous-matching-input-string-position)
(comint-previous-matching-input)
(comint-replace-by-expanded-history-before-point, comint-send-input)
(comint-copy-old-input, comint-backward-matching-input)
(comint-goto-process-mark, comint-set-process-mark):
* lisp/calendar/calendar.el (calendar-cursor-to-date): Use it.
* lisp/bindings.el (debug-ignored-errors): Remove regexps, add `user-error'.
* src/data.c (PUT_ERROR): New macro.
(syms_of_data): Use it. Add new error type `user-error'.
* src/undo.c (user_error): New function.
(Fprimitive_undo): Use it.
* src/print.c (print_error_message): Adjust print style for `user-error'.
* src/keyboard.c (user_error): New function.
(Fexit_recursive_edit, Fabort_recursive_edit): Use it.
2012-05-04 23:16:47 +00:00
|
|
|
|
;; FIXME: Maybe beginning-of-line, beginning-of-buffer, end-of-line,
|
|
|
|
|
;; end-of-buffer, end-of-file, buffer-read-only, and
|
|
|
|
|
;; file-supersession should all be user-errors!
|
2018-11-05 00:22:15 +00:00
|
|
|
|
'(beginning-of-line beginning-of-buffer end-of-line
|
|
|
|
|
end-of-buffer end-of-file buffer-read-only
|
|
|
|
|
file-supersession mark-inactive
|
|
|
|
|
user-error ;; That's the main one!
|
|
|
|
|
))
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
|
|
|
|
(make-variable-buffer-local 'indent-tabs-mode)
|
|
|
|
|
|
2012-07-13 14:25:59 +00:00
|
|
|
|
;; These per-buffer variables are never reset by
|
|
|
|
|
;; `kill-all-local-variables', because they have no default value.
|
|
|
|
|
;; For consistency, we give them the `permanent-local' property, even
|
|
|
|
|
;; though `kill-all-local-variables' does not actually consult it.
|
2017-11-22 21:36:07 +00:00
|
|
|
|
;; See init_buffer_once in buffer.c for the origins of this list.
|
2012-07-13 14:25:59 +00:00
|
|
|
|
|
2012-07-13 17:02:18 +00:00
|
|
|
|
(mapc (lambda (sym) (put sym 'permanent-local t))
|
|
|
|
|
'(buffer-file-name default-directory buffer-backed-up
|
|
|
|
|
buffer-saved-size buffer-auto-save-file-name
|
|
|
|
|
buffer-read-only buffer-undo-list mark-active
|
|
|
|
|
point-before-scroll buffer-file-truename
|
|
|
|
|
buffer-file-format buffer-auto-save-file-format
|
|
|
|
|
buffer-display-count buffer-display-time
|
2017-11-22 21:36:07 +00:00
|
|
|
|
enable-multibyte-characters
|
2017-11-30 17:40:46 +00:00
|
|
|
|
buffer-file-coding-system truncate-lines))
|
2012-07-13 14:25:59 +00:00
|
|
|
|
|
2011-05-24 08:22:58 +00:00
|
|
|
|
;; We have base64, md5 and sha1 functions built in now.
|
2001-11-17 00:27:08 +00:00
|
|
|
|
(provide 'base64)
|
|
|
|
|
(provide 'md5)
|
2011-05-24 08:22:58 +00:00
|
|
|
|
(provide 'sha1)
|
2001-11-17 00:27:08 +00:00
|
|
|
|
(provide 'overlay '(display syntax-table field))
|
|
|
|
|
(provide 'text-properties '(display syntax-table field point-entered))
|
1998-11-29 21:52:25 +00:00
|
|
|
|
|
1997-06-19 02:49:41 +00:00
|
|
|
|
(define-key esc-map "\t" 'complete-symbol)
|
|
|
|
|
|
2010-12-06 21:06:02 +00:00
|
|
|
|
(defun complete-symbol (arg)
|
|
|
|
|
"Perform completion on the text around point.
|
|
|
|
|
The completion method is determined by `completion-at-point-functions'.
|
|
|
|
|
|
|
|
|
|
With a prefix argument, this command does completion within
|
|
|
|
|
the collection of symbols listed in the index of the manual for the
|
|
|
|
|
language you are using."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(if arg (info-complete-symbol) (completion-at-point)))
|
|
|
|
|
|
1996-09-11 19:05:36 +00:00
|
|
|
|
;; Reduce total amount of space we must allocate during this function
|
|
|
|
|
;; that we will not need to keep permanently.
|
|
|
|
|
(garbage-collect)
|
|
|
|
|
|
1997-05-12 23:22:22 +00:00
|
|
|
|
|
2013-04-18 02:20:12 +00:00
|
|
|
|
(setq help-event-list '(help f1 ?\?))
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
1998-01-02 23:52:11 +00:00
|
|
|
|
(make-variable-buffer-local 'minor-mode-overriding-map-alist)
|
|
|
|
|
|
2001-11-17 00:27:08 +00:00
|
|
|
|
;; From frame.c
|
|
|
|
|
(global-set-key [switch-frame] 'handle-switch-frame)
|
2003-04-11 22:40:58 +00:00
|
|
|
|
(global-set-key [select-window] 'handle-select-window)
|
|
|
|
|
|
|
|
|
|
;; FIXME: Do those 3 events really ever reach the global-map ?
|
|
|
|
|
;; It seems that they can't because they're handled via
|
|
|
|
|
;; special-event-map which is used at very low-level. -stef
|
2001-11-17 00:27:08 +00:00
|
|
|
|
(global-set-key [delete-frame] 'handle-delete-frame)
|
|
|
|
|
(global-set-key [iconify-frame] 'ignore-event)
|
|
|
|
|
(global-set-key [make-frame-visible] 'ignore-event)
|
|
|
|
|
|
|
|
|
|
|
1996-09-11 19:05:36 +00:00
|
|
|
|
;These commands are defined in editfns.c
|
|
|
|
|
;but they are not assigned to keys there.
|
|
|
|
|
(put 'narrow-to-region 'disabled t)
|
2008-06-30 19:37:02 +00:00
|
|
|
|
|
2010-05-29 15:19:13 +00:00
|
|
|
|
;; Moving with arrows in bidi-sensitive direction.
|
2013-06-29 13:36:19 +00:00
|
|
|
|
(defcustom visual-order-cursor-movement nil
|
|
|
|
|
"If non-nil, moving cursor with arrow keys follows the visual order.
|
|
|
|
|
|
|
|
|
|
When this is non-nil, \\[right-char] will move to the character that is
|
|
|
|
|
to the right of point on display, and \\[left-char] will move to the left,
|
|
|
|
|
disregarding the surrounding bidirectional context. Depending on the
|
|
|
|
|
bidirectional context of the surrounding characters, this can move point
|
|
|
|
|
many buffer positions away.
|
|
|
|
|
|
|
|
|
|
When the text is entirely left-to-right, logical-order and visual-order
|
|
|
|
|
cursor movements produce identical results."
|
|
|
|
|
:type '(choice (const :tag "Logical-order cursor movement" nil)
|
|
|
|
|
(const :tag "Visual-order cursor movement" t))
|
|
|
|
|
:group 'display
|
2013-12-13 01:54:09 +00:00
|
|
|
|
:version "24.4")
|
2013-06-29 13:36:19 +00:00
|
|
|
|
|
2010-05-29 15:19:13 +00:00
|
|
|
|
(defun right-char (&optional n)
|
|
|
|
|
"Move point N characters to the right (to the left if N is negative).
|
|
|
|
|
On reaching beginning or end of buffer, stop and signal error.
|
|
|
|
|
|
2013-06-29 13:36:19 +00:00
|
|
|
|
If `visual-order-cursor-movement' is non-nil, this always moves
|
|
|
|
|
to the right on display, wherever that is in the buffer.
|
|
|
|
|
Otherwise, depending on the bidirectional context, this may move
|
|
|
|
|
one position either forward or backward in the buffer. This is
|
|
|
|
|
in contrast with \\[forward-char] and \\[backward-char], which
|
|
|
|
|
see."
|
2010-05-29 15:19:13 +00:00
|
|
|
|
(interactive "^p")
|
2013-06-29 13:36:19 +00:00
|
|
|
|
(if visual-order-cursor-movement
|
2021-01-05 01:57:42 +00:00
|
|
|
|
(dotimes (_ (if (numberp n) (abs n) 1))
|
2013-06-30 14:49:33 +00:00
|
|
|
|
(move-point-visually (if (and (numberp n) (< n 0)) -1 1)))
|
2013-06-29 13:36:19 +00:00
|
|
|
|
(if (eq (current-bidi-paragraph-direction) 'left-to-right)
|
|
|
|
|
(forward-char n)
|
|
|
|
|
(backward-char n))))
|
2010-05-29 15:19:13 +00:00
|
|
|
|
|
|
|
|
|
(defun left-char ( &optional n)
|
|
|
|
|
"Move point N characters to the left (to the right if N is negative).
|
|
|
|
|
On reaching beginning or end of buffer, stop and signal error.
|
|
|
|
|
|
2013-06-29 13:36:19 +00:00
|
|
|
|
If `visual-order-cursor-movement' is non-nil, this always moves
|
|
|
|
|
to the left on display, wherever that is in the buffer.
|
|
|
|
|
Otherwise, depending on the bidirectional context, this may move
|
|
|
|
|
one position either backward or forward in the buffer. This is
|
|
|
|
|
in contrast with \\[forward-char] and \\[backward-char], which
|
|
|
|
|
see."
|
2010-05-29 15:19:13 +00:00
|
|
|
|
(interactive "^p")
|
2013-06-29 13:36:19 +00:00
|
|
|
|
(if visual-order-cursor-movement
|
2021-01-05 01:57:42 +00:00
|
|
|
|
(dotimes (_ (if (numberp n) (abs n) 1))
|
2013-06-30 14:49:33 +00:00
|
|
|
|
(move-point-visually (if (and (numberp n) (< n 0)) 1 -1)))
|
2013-06-29 13:36:19 +00:00
|
|
|
|
(if (eq (current-bidi-paragraph-direction) 'left-to-right)
|
|
|
|
|
(backward-char n)
|
|
|
|
|
(forward-char n))))
|
2010-05-29 15:19:13 +00:00
|
|
|
|
|
|
|
|
|
(defun right-word (&optional n)
|
|
|
|
|
"Move point N words to the right (to the left if N is negative).
|
|
|
|
|
|
|
|
|
|
Depending on the bidirectional context, this may move either forward
|
|
|
|
|
or backward in the buffer. This is in contrast with \\[forward-word]
|
|
|
|
|
and \\[backward-word], which see.
|
|
|
|
|
|
|
|
|
|
Value is normally t.
|
|
|
|
|
If an edge of the buffer or a field boundary is reached, point is left there
|
2018-04-13 10:09:35 +00:00
|
|
|
|
and the function returns nil. Field boundaries are not noticed
|
2010-05-29 15:19:13 +00:00
|
|
|
|
if `inhibit-field-text-motion' is non-nil."
|
|
|
|
|
(interactive "^p")
|
|
|
|
|
(if (eq (current-bidi-paragraph-direction) 'left-to-right)
|
|
|
|
|
(forward-word n)
|
|
|
|
|
(backward-word n)))
|
|
|
|
|
|
|
|
|
|
(defun left-word (&optional n)
|
|
|
|
|
"Move point N words to the left (to the right if N is negative).
|
|
|
|
|
|
|
|
|
|
Depending on the bidirectional context, this may move either backward
|
|
|
|
|
or forward in the buffer. This is in contrast with \\[backward-word]
|
|
|
|
|
and \\[forward-word], which see.
|
|
|
|
|
|
|
|
|
|
Value is normally t.
|
|
|
|
|
If an edge of the buffer or a field boundary is reached, point is left there
|
2018-04-13 10:09:35 +00:00
|
|
|
|
and the function returns nil. Field boundaries are not noticed
|
2010-05-29 15:19:13 +00:00
|
|
|
|
if `inhibit-field-text-motion' is non-nil."
|
|
|
|
|
(interactive "^p")
|
|
|
|
|
(if (eq (current-bidi-paragraph-direction) 'left-to-right)
|
|
|
|
|
(backward-word n)
|
|
|
|
|
(forward-word n)))
|
|
|
|
|
|
2008-06-30 19:37:02 +00:00
|
|
|
|
(defvar narrow-map (make-sparse-keymap)
|
|
|
|
|
"Keymap for narrowing commands.")
|
|
|
|
|
(define-key ctl-x-map "n" narrow-map)
|
|
|
|
|
|
|
|
|
|
(define-key narrow-map "n" 'narrow-to-region)
|
|
|
|
|
(define-key narrow-map "w" 'widen)
|
2020-10-29 09:18:33 +00:00
|
|
|
|
(define-key narrow-map "g" 'goto-line-relative)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
2005-04-19 09:25:32 +00:00
|
|
|
|
;; Quitting
|
|
|
|
|
(define-key global-map "\e\e\e" 'keyboard-escape-quit)
|
|
|
|
|
(define-key global-map "\C-g" 'keyboard-quit)
|
|
|
|
|
|
2007-09-20 21:49:18 +00:00
|
|
|
|
;; Used to be in termdev.el: when using several terminals, make C-z
|
|
|
|
|
;; suspend only the relevant terminal.
|
|
|
|
|
(substitute-key-definition 'suspend-emacs 'suspend-frame global-map)
|
|
|
|
|
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key global-map "\C-m" 'newline)
|
|
|
|
|
(define-key global-map "\C-o" 'open-line)
|
|
|
|
|
(define-key esc-map "\C-o" 'split-line)
|
|
|
|
|
(define-key global-map "\C-q" 'quoted-insert)
|
|
|
|
|
(define-key esc-map "^" 'delete-indentation)
|
|
|
|
|
(define-key esc-map "\\" 'delete-horizontal-space)
|
|
|
|
|
(define-key esc-map "m" 'back-to-indentation)
|
|
|
|
|
(define-key ctl-x-map "\C-o" 'delete-blank-lines)
|
|
|
|
|
(define-key esc-map " " 'just-one-space)
|
|
|
|
|
(define-key esc-map "z" 'zap-to-char)
|
2012-08-10 16:02:48 +00:00
|
|
|
|
(define-key esc-map "=" 'count-words-region)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key ctl-x-map "=" 'what-cursor-position)
|
|
|
|
|
(define-key esc-map ":" 'eval-expression)
|
|
|
|
|
;; Define ESC ESC : like ESC : for people who type ESC ESC out of habit.
|
|
|
|
|
(define-key esc-map "\M-:" 'eval-expression)
|
|
|
|
|
;; Changed from C-x ESC so that function keys work following C-x.
|
|
|
|
|
(define-key ctl-x-map "\e\e" 'repeat-complex-command)
|
|
|
|
|
;; New binding analogous to M-:.
|
|
|
|
|
(define-key ctl-x-map "\M-:" 'repeat-complex-command)
|
2009-09-11 00:58:59 +00:00
|
|
|
|
(define-key ctl-x-map "u" 'undo)
|
|
|
|
|
(put 'undo :advertised-binding [?\C-x ?u])
|
1996-09-11 19:05:36 +00:00
|
|
|
|
;; Many people are used to typing C-/ on X terminals and getting C-_.
|
|
|
|
|
(define-key global-map [?\C-/] 'undo)
|
|
|
|
|
(define-key global-map "\C-_" 'undo)
|
2005-04-19 09:25:32 +00:00
|
|
|
|
;; Richard said that we should not use C-x <uppercase letter> and I have
|
|
|
|
|
;; no idea whereas to bind it. Any suggestion welcome. -stef
|
|
|
|
|
;; (define-key ctl-x-map "U" 'undo-only)
|
2021-02-17 18:04:42 +00:00
|
|
|
|
(defvar undo-repeat-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(define-key map "u" 'undo)
|
|
|
|
|
map)
|
|
|
|
|
"Keymap to repeat undo key sequences `C-x u u'. Used in `repeat-mode'.")
|
|
|
|
|
(put 'undo 'repeat-map 'undo-repeat-map)
|
2005-04-19 09:25:32 +00:00
|
|
|
|
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key esc-map "!" 'shell-command)
|
|
|
|
|
(define-key esc-map "|" 'shell-command-on-region)
|
2009-07-02 22:48:18 +00:00
|
|
|
|
(define-key esc-map "&" 'async-shell-command)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
2008-06-30 19:37:02 +00:00
|
|
|
|
(define-key ctl-x-map [right] 'next-buffer)
|
|
|
|
|
(define-key ctl-x-map [C-right] 'next-buffer)
|
2012-06-08 04:23:26 +00:00
|
|
|
|
(define-key global-map [XF86Forward] 'next-buffer)
|
2019-11-27 22:35:53 +00:00
|
|
|
|
(put 'next-buffer :advertised-binding [?\C-x right])
|
2008-06-30 19:37:02 +00:00
|
|
|
|
(define-key ctl-x-map [left] 'previous-buffer)
|
|
|
|
|
(define-key ctl-x-map [C-left] 'previous-buffer)
|
2012-06-08 04:23:26 +00:00
|
|
|
|
(define-key global-map [XF86Back] 'previous-buffer)
|
2019-11-27 22:35:53 +00:00
|
|
|
|
(put 'previous-buffer :advertised-binding [?\C-x left])
|
2005-04-19 09:25:32 +00:00
|
|
|
|
|
2001-10-12 19:24:21 +00:00
|
|
|
|
(let ((map minibuffer-local-map))
|
|
|
|
|
(define-key map "\en" 'next-history-element)
|
|
|
|
|
(define-key map [next] 'next-history-element)
|
2014-11-18 21:33:42 +00:00
|
|
|
|
(define-key map [down] 'next-line-or-history-element)
|
2012-06-08 04:23:26 +00:00
|
|
|
|
(define-key map [XF86Forward] 'next-history-element)
|
2001-10-12 19:24:21 +00:00
|
|
|
|
(define-key map "\ep" 'previous-history-element)
|
|
|
|
|
(define-key map [prior] 'previous-history-element)
|
2014-11-18 21:33:42 +00:00
|
|
|
|
(define-key map [up] 'previous-line-or-history-element)
|
2012-06-08 04:23:26 +00:00
|
|
|
|
(define-key map [XF86Back] 'previous-history-element)
|
2001-10-12 19:24:21 +00:00
|
|
|
|
(define-key map "\es" 'next-matching-history-element)
|
2006-07-18 14:39:57 +00:00
|
|
|
|
(define-key map "\er" 'previous-matching-history-element)
|
|
|
|
|
;; Override the global binding (which calls indent-relative via
|
|
|
|
|
;; indent-for-tab-command). The alignment that indent-relative tries to
|
|
|
|
|
;; do doesn't make much sense here since the prompt messes it up.
|
2007-11-15 12:01:04 +00:00
|
|
|
|
(define-key map "\t" 'self-insert-command)
|
2008-03-25 21:48:28 +00:00
|
|
|
|
(define-key map [C-tab] 'file-cache-minibuffer-complete))
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
|
|
|
|
(define-key global-map "\C-u" 'universal-argument)
|
|
|
|
|
(let ((i ?0))
|
|
|
|
|
(while (<= i ?9)
|
|
|
|
|
(define-key esc-map (char-to-string i) 'digit-argument)
|
|
|
|
|
(setq i (1+ i))))
|
|
|
|
|
(define-key esc-map "-" 'negative-argument)
|
|
|
|
|
;; Define control-digits.
|
|
|
|
|
(let ((i ?0))
|
|
|
|
|
(while (<= i ?9)
|
|
|
|
|
(define-key global-map (read (format "[?\\C-%c]" i)) 'digit-argument)
|
|
|
|
|
(setq i (1+ i))))
|
|
|
|
|
(define-key global-map [?\C--] 'negative-argument)
|
|
|
|
|
;; Define control-meta-digits.
|
|
|
|
|
(let ((i ?0))
|
|
|
|
|
(while (<= i ?9)
|
|
|
|
|
(define-key esc-map (read (format "[?\\C-%c]" i)) 'digit-argument)
|
|
|
|
|
(setq i (1+ i))))
|
|
|
|
|
(define-key global-map [?\C-\M--] 'negative-argument)
|
|
|
|
|
|
2011-08-20 22:41:41 +00:00
|
|
|
|
;; Update tutorial--default-keys if you change these.
|
2010-06-28 01:01:11 +00:00
|
|
|
|
(define-key global-map "\177" 'delete-backward-char)
|
2014-03-04 03:14:11 +00:00
|
|
|
|
;; We explicitly want C-d to use `delete-char' instead of
|
|
|
|
|
;; `delete-forward-char' so that it ignores `delete-active-region':
|
|
|
|
|
;; Most C-d users are old-timers who don't expect
|
|
|
|
|
;; `delete-active-region' here, while newer users who expect
|
|
|
|
|
;; `delete-active-region' use C-d much less.
|
2010-10-19 15:43:27 +00:00
|
|
|
|
(define-key global-map "\C-d" 'delete-char)
|
2010-06-28 01:01:11 +00:00
|
|
|
|
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key global-map "\C-k" 'kill-line)
|
|
|
|
|
(define-key global-map "\C-w" 'kill-region)
|
|
|
|
|
(define-key esc-map "w" 'kill-ring-save)
|
|
|
|
|
(define-key esc-map "\C-w" 'append-next-kill)
|
|
|
|
|
(define-key global-map "\C-y" 'yank)
|
|
|
|
|
(define-key esc-map "y" 'yank-pop)
|
|
|
|
|
|
|
|
|
|
;; (define-key ctl-x-map "a" 'append-to-buffer)
|
|
|
|
|
|
|
|
|
|
(define-key global-map "\C-@" 'set-mark-command)
|
|
|
|
|
;; Many people are used to typing C-SPC and getting C-@.
|
1998-01-12 05:48:48 +00:00
|
|
|
|
(define-key global-map [?\C- ] 'set-mark-command)
|
2011-07-14 01:58:51 +00:00
|
|
|
|
(put 'set-mark-command :advertised-binding [?\C- ])
|
|
|
|
|
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key ctl-x-map "\C-x" 'exchange-point-and-mark)
|
|
|
|
|
(define-key ctl-x-map "\C-@" 'pop-global-mark)
|
2013-11-11 05:18:53 +00:00
|
|
|
|
(define-key ctl-x-map " " 'rectangle-mark-mode)
|
1998-01-12 05:48:48 +00:00
|
|
|
|
(define-key ctl-x-map [?\C- ] 'pop-global-mark)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
|
|
|
|
(define-key global-map "\C-n" 'next-line)
|
|
|
|
|
(define-key global-map "\C-p" 'previous-line)
|
|
|
|
|
(define-key ctl-x-map "\C-n" 'set-goal-column)
|
2005-03-07 11:12:21 +00:00
|
|
|
|
(define-key global-map "\C-a" 'move-beginning-of-line)
|
2004-11-20 19:09:13 +00:00
|
|
|
|
(define-key global-map "\C-e" 'move-end-of-line)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
2005-04-19 09:25:32 +00:00
|
|
|
|
(define-key ctl-x-map "`" 'next-error)
|
|
|
|
|
|
2021-02-17 18:04:42 +00:00
|
|
|
|
(defvar next-error-repeat-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(define-key map "n" 'next-error)
|
|
|
|
|
(define-key map "\M-n" 'next-error)
|
|
|
|
|
(define-key map "p" 'previous-error)
|
|
|
|
|
(define-key map "\M-p" 'previous-error)
|
|
|
|
|
map)
|
|
|
|
|
"Keymap to repeat next-error key sequences. Used in `repeat-mode'.")
|
|
|
|
|
(put 'next-error 'repeat-map 'next-error-repeat-map)
|
|
|
|
|
(put 'previous-error 'repeat-map 'next-error-repeat-map)
|
|
|
|
|
|
2008-06-25 20:17:07 +00:00
|
|
|
|
(defvar goto-map (make-sparse-keymap)
|
|
|
|
|
"Keymap for navigation commands.")
|
|
|
|
|
(define-key esc-map "g" goto-map)
|
|
|
|
|
|
2012-04-15 09:16:50 +00:00
|
|
|
|
(define-key goto-map "c" 'goto-char)
|
2008-06-25 20:17:07 +00:00
|
|
|
|
(define-key goto-map "g" 'goto-line)
|
|
|
|
|
(define-key goto-map "\M-g" 'goto-line)
|
|
|
|
|
(define-key goto-map "n" 'next-error)
|
|
|
|
|
(define-key goto-map "\M-n" 'next-error)
|
|
|
|
|
(define-key goto-map "p" 'previous-error)
|
|
|
|
|
(define-key goto-map "\M-p" 'previous-error)
|
2012-09-30 08:35:11 +00:00
|
|
|
|
(define-key goto-map "\t" 'move-to-column)
|
2008-06-25 20:17:07 +00:00
|
|
|
|
|
|
|
|
|
(defvar search-map (make-sparse-keymap)
|
|
|
|
|
"Keymap for search related commands.")
|
|
|
|
|
(define-key esc-map "s" search-map)
|
|
|
|
|
|
2014-11-14 06:14:06 +00:00
|
|
|
|
(define-key search-map "o" 'occur)
|
2014-11-17 18:46:51 +00:00
|
|
|
|
(define-key search-map "\M-w" 'eww-search-words)
|
2014-11-14 06:14:06 +00:00
|
|
|
|
(define-key search-map "hr" 'highlight-regexp)
|
|
|
|
|
(define-key search-map "hp" 'highlight-phrase)
|
|
|
|
|
(define-key search-map "hl" 'highlight-lines-matching-regexp)
|
|
|
|
|
(define-key search-map "h." 'highlight-symbol-at-point)
|
|
|
|
|
(define-key search-map "hu" 'unhighlight-regexp)
|
|
|
|
|
(define-key search-map "hf" 'hi-lock-find-patterns)
|
|
|
|
|
(define-key search-map "hw" 'hi-lock-write-interactive-patterns)
|
2018-11-07 22:33:05 +00:00
|
|
|
|
(put 'highlight-regexp :advertised-binding [?\M-s ?h ?r])
|
|
|
|
|
(put 'highlight-phrase :advertised-binding [?\M-s ?h ?p])
|
|
|
|
|
(put 'highlight-lines-matching-regexp :advertised-binding [?\M-s ?h ?l])
|
|
|
|
|
(put 'highlight-symbol-at-point :advertised-binding [?\M-s ?h ?.])
|
|
|
|
|
(put 'unhighlight-regexp :advertised-binding [?\M-s ?h ?u])
|
|
|
|
|
(put 'hi-lock-find-patterns :advertised-binding [?\M-s ?h ?f])
|
|
|
|
|
(put 'hi-lock-write-interactive-patterns :advertised-binding [?\M-s ?h ?w])
|
2005-04-19 09:25:32 +00:00
|
|
|
|
|
1996-09-11 19:05:36 +00:00
|
|
|
|
;;(defun function-key-error ()
|
|
|
|
|
;; (interactive)
|
2001-07-14 11:21:08 +00:00
|
|
|
|
;; (error "That function key is not bound to anything"))
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
|
|
|
|
(define-key global-map [menu] 'execute-extended-command)
|
|
|
|
|
(define-key global-map [find] 'search-forward)
|
|
|
|
|
|
2001-01-16 20:27:08 +00:00
|
|
|
|
;; Don't do this. We define <delete> in function-key-map instead.
|
|
|
|
|
;(define-key global-map [delete] 'backward-delete-char)
|
2000-07-07 14:14:44 +00:00
|
|
|
|
|
1996-09-11 19:05:36 +00:00
|
|
|
|
;; natural bindings for terminal keycaps --- defined in X keysym order
|
2019-08-20 17:04:16 +00:00
|
|
|
|
(define-key global-map [Scroll_Lock] 'scroll-lock-mode)
|
2003-06-10 04:06:10 +00:00
|
|
|
|
(define-key global-map [C-S-backspace] 'kill-whole-line)
|
2005-10-04 21:50:34 +00:00
|
|
|
|
(define-key global-map [home] 'move-beginning-of-line)
|
2001-01-09 13:11:34 +00:00
|
|
|
|
(define-key global-map [C-home] 'beginning-of-buffer)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key global-map [M-home] 'beginning-of-buffer-other-window)
|
2005-06-11 07:14:38 +00:00
|
|
|
|
(define-key esc-map [home] 'beginning-of-buffer-other-window)
|
2010-05-29 15:19:13 +00:00
|
|
|
|
(define-key global-map [left] 'left-char)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key global-map [up] 'previous-line)
|
2010-05-29 15:19:13 +00:00
|
|
|
|
(define-key global-map [right] 'right-char)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key global-map [down] 'next-line)
|
2010-04-05 23:38:53 +00:00
|
|
|
|
(define-key global-map [prior] 'scroll-down-command)
|
|
|
|
|
(define-key global-map [next] 'scroll-up-command)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key global-map [C-up] 'backward-paragraph)
|
|
|
|
|
(define-key global-map [C-down] 'forward-paragraph)
|
|
|
|
|
(define-key global-map [C-prior] 'scroll-right)
|
2004-09-20 16:14:28 +00:00
|
|
|
|
(put 'scroll-left 'disabled t)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key global-map [C-next] 'scroll-left)
|
|
|
|
|
(define-key global-map [M-next] 'scroll-other-window)
|
2005-06-11 07:14:38 +00:00
|
|
|
|
(define-key esc-map [next] 'scroll-other-window)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key global-map [M-prior] 'scroll-other-window-down)
|
2005-06-11 07:14:38 +00:00
|
|
|
|
(define-key esc-map [prior] 'scroll-other-window-down)
|
2005-04-19 09:25:32 +00:00
|
|
|
|
(define-key esc-map [?\C-\S-v] 'scroll-other-window-down)
|
2005-10-04 21:50:34 +00:00
|
|
|
|
(define-key global-map [end] 'move-end-of-line)
|
2001-01-09 13:11:34 +00:00
|
|
|
|
(define-key global-map [C-end] 'end-of-buffer)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key global-map [M-end] 'end-of-buffer-other-window)
|
2005-06-11 07:14:38 +00:00
|
|
|
|
(define-key esc-map [end] 'end-of-buffer-other-window)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key global-map [begin] 'beginning-of-buffer)
|
|
|
|
|
(define-key global-map [M-begin] 'beginning-of-buffer-other-window)
|
2005-06-11 07:14:38 +00:00
|
|
|
|
(define-key esc-map [begin] 'beginning-of-buffer-other-window)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
;; (define-key global-map [select] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [print] 'function-key-error)
|
|
|
|
|
(define-key global-map [execute] 'execute-extended-command)
|
|
|
|
|
(define-key global-map [insert] 'overwrite-mode)
|
|
|
|
|
(define-key global-map [C-insert] 'kill-ring-save)
|
|
|
|
|
(define-key global-map [S-insert] 'yank)
|
2005-06-28 18:53:30 +00:00
|
|
|
|
;; `insertchar' is what term.c produces. Should we change term.c
|
|
|
|
|
;; to produce `insert' instead?
|
|
|
|
|
(define-key global-map [insertchar] 'overwrite-mode)
|
|
|
|
|
(define-key global-map [C-insertchar] 'kill-ring-save)
|
|
|
|
|
(define-key global-map [S-insertchar] 'yank)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key global-map [undo] 'undo)
|
|
|
|
|
(define-key global-map [redo] 'repeat-complex-command)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(define-key global-map [again] 'repeat-complex-command) ; Sun keyboard
|
|
|
|
|
(define-key global-map [open] 'find-file) ; Sun
|
|
|
|
|
;; The following wouldn't work to interrupt running code since C-g is
|
|
|
|
|
;; treated specially in the event loop.
|
|
|
|
|
;; (define-key global-map [stop] 'keyboard-quit) ; Sun
|
1996-09-11 19:05:36 +00:00
|
|
|
|
;; (define-key global-map [clearline] 'function-key-error)
|
|
|
|
|
(define-key global-map [insertline] 'open-line)
|
|
|
|
|
(define-key global-map [deleteline] 'kill-line)
|
2010-10-19 15:43:27 +00:00
|
|
|
|
(define-key global-map [deletechar] 'delete-forward-char)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
;; (define-key global-map [backtab] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f1] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f2] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f3] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f4] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f5] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f6] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f7] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f8] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f9] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f10] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f11] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f12] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f13] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f14] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f15] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f16] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f17] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f18] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f19] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f20] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f21] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f22] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f23] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f24] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f25] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f26] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f27] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f28] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f29] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f30] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f31] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f32] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f33] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f34] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [f35] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-backtab] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-space] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-tab] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-enter] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-f1] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-f2] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-f3] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-f4] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-multiply] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-add] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-separator] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-subtract] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-decimal] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-divide] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-0] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-1] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-2] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-3] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-4] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-5] 'recenter)
|
|
|
|
|
;; (define-key global-map [kp-6] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-7] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-8] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-9] 'function-key-error)
|
|
|
|
|
;; (define-key global-map [kp-equal] 'function-key-error)
|
|
|
|
|
|
|
|
|
|
;; X11R6 distinguishes these keys from the non-kp keys.
|
|
|
|
|
;; Make them behave like the non-kp keys unless otherwise bound.
|
2009-10-19 15:03:24 +00:00
|
|
|
|
;; FIXME: rather than list such mappings for every modifier-combination,
|
|
|
|
|
;; we should come up with a way to do it generically, something like
|
|
|
|
|
;; (define-key function-key-map [*-kp-home] [*-home])
|
2013-12-11 00:45:10 +00:00
|
|
|
|
;; Currently we add keypad key combinations with basic modifiers
|
|
|
|
|
;; (to complement plain bindings in "Keypad support" section in simple.el)
|
|
|
|
|
;; Until [*-kp-home] is implemented, for more modifiers we could also use:
|
|
|
|
|
;; (todo-powerset '(control meta shift hyper super alt)) (Bug#14397)
|
|
|
|
|
(let ((modifiers '(nil (control) (meta) (control meta) (shift)
|
|
|
|
|
(control shift) (meta shift) (control meta shift)))
|
|
|
|
|
(keys '((kp-delete delete) (kp-insert insert)
|
|
|
|
|
(kp-end end) (kp-down down) (kp-next next)
|
|
|
|
|
(kp-left left) (kp-begin begin) (kp-right right)
|
|
|
|
|
(kp-home home) (kp-up up) (kp-prior prior)
|
|
|
|
|
(kp-enter enter) (kp-decimal ?.)
|
|
|
|
|
(kp-0 ?0) (kp-1 ?1) (kp-2 ?2) (kp-3 ?3) (kp-4 ?4)
|
|
|
|
|
(kp-5 ?5) (kp-6 ?6) (kp-7 ?7) (kp-8 ?8) (kp-9 ?9)
|
2013-12-13 01:03:04 +00:00
|
|
|
|
(kp-add ?+) (kp-subtract ?-) (kp-multiply ?*) (kp-divide ?/))))
|
2013-12-11 00:45:10 +00:00
|
|
|
|
(dolist (pair keys)
|
2014-06-14 09:50:13 +00:00
|
|
|
|
(let ((keypad (nth 0 pair))
|
|
|
|
|
(normal (nth 1 pair)))
|
|
|
|
|
(when (characterp normal)
|
|
|
|
|
(put keypad 'ascii-character normal))
|
|
|
|
|
(dolist (mod modifiers)
|
|
|
|
|
(define-key function-key-map
|
|
|
|
|
(vector (append mod (list keypad)))
|
|
|
|
|
(vector (append mod (list normal))))))))
|
2013-12-11 00:45:10 +00:00
|
|
|
|
|
2001-01-16 20:27:08 +00:00
|
|
|
|
(define-key function-key-map [backspace] [?\C-?])
|
|
|
|
|
(define-key function-key-map [delete] [?\C-?])
|
2001-01-31 15:06:28 +00:00
|
|
|
|
(define-key function-key-map [kp-delete] [?\C-?])
|
2013-12-11 00:45:10 +00:00
|
|
|
|
|
2002-01-02 13:46:25 +00:00
|
|
|
|
;; Don't bind shifted keypad numeric keys, they reportedly
|
|
|
|
|
;; interfere with the feature of some keyboards to produce
|
|
|
|
|
;; numbers when NumLock is off.
|
|
|
|
|
;(define-key function-key-map [S-kp-1] [S-end])
|
|
|
|
|
;(define-key function-key-map [S-kp-2] [S-down])
|
|
|
|
|
;(define-key function-key-map [S-kp-3] [S-next])
|
|
|
|
|
;(define-key function-key-map [S-kp-4] [S-left])
|
|
|
|
|
;(define-key function-key-map [S-kp-6] [S-right])
|
|
|
|
|
;(define-key function-key-map [S-kp-7] [S-home])
|
|
|
|
|
;(define-key function-key-map [S-kp-8] [S-up])
|
|
|
|
|
;(define-key function-key-map [S-kp-9] [S-prior])
|
2013-12-11 00:45:10 +00:00
|
|
|
|
;(define-key function-key-map [C-S-kp-1] [C-S-end])
|
|
|
|
|
;(define-key function-key-map [C-S-kp-2] [C-S-down])
|
|
|
|
|
;(define-key function-key-map [C-S-kp-3] [C-S-next])
|
|
|
|
|
;(define-key function-key-map [C-S-kp-4] [C-S-left])
|
|
|
|
|
;(define-key function-key-map [C-S-kp-6] [C-S-right])
|
|
|
|
|
;(define-key function-key-map [C-S-kp-7] [C-S-home])
|
|
|
|
|
;(define-key function-key-map [C-S-kp-8] [C-S-up])
|
|
|
|
|
;(define-key function-key-map [C-S-kp-9] [C-S-prior])
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
2009-10-19 15:03:24 +00:00
|
|
|
|
;; Hitting C-SPC on text terminals, usually sends the ascii code 0 (aka C-@),
|
|
|
|
|
;; so we can't distinguish those two keys, but usually we consider C-SPC
|
|
|
|
|
;; (rather than C-@) as the "canonical" binding.
|
|
|
|
|
(define-key function-key-map [?\C-@] [?\C-\s])
|
2010-08-02 00:13:02 +00:00
|
|
|
|
;; Many keyboards don't have a `backtab' key, so by convention the user
|
|
|
|
|
;; can use S-tab instead to access that binding.
|
|
|
|
|
(define-key function-key-map [S-tab] [backtab])
|
2009-10-19 15:03:24 +00:00
|
|
|
|
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key global-map [mouse-movement] 'ignore)
|
|
|
|
|
|
|
|
|
|
(define-key global-map "\C-t" 'transpose-chars)
|
|
|
|
|
(define-key esc-map "t" 'transpose-words)
|
|
|
|
|
(define-key esc-map "\C-t" 'transpose-sexps)
|
|
|
|
|
(define-key ctl-x-map "\C-t" 'transpose-lines)
|
|
|
|
|
|
2000-05-25 19:06:34 +00:00
|
|
|
|
(define-key esc-map ";" 'comment-dwim)
|
2019-06-27 14:57:47 +00:00
|
|
|
|
(define-key esc-map "j" 'default-indent-new-line)
|
|
|
|
|
(define-key esc-map "\C-j" 'default-indent-new-line)
|
2000-05-25 19:06:34 +00:00
|
|
|
|
(define-key ctl-x-map ";" 'comment-set-column)
|
2015-02-23 06:00:01 +00:00
|
|
|
|
(define-key ctl-x-map [?\C-\;] 'comment-line)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key ctl-x-map "f" 'set-fill-column)
|
|
|
|
|
(define-key ctl-x-map "$" 'set-selective-display)
|
|
|
|
|
|
|
|
|
|
(define-key esc-map "@" 'mark-word)
|
|
|
|
|
(define-key esc-map "f" 'forward-word)
|
|
|
|
|
(define-key esc-map "b" 'backward-word)
|
|
|
|
|
(define-key esc-map "d" 'kill-word)
|
|
|
|
|
(define-key esc-map "\177" 'backward-kill-word)
|
|
|
|
|
|
|
|
|
|
(define-key esc-map "<" 'beginning-of-buffer)
|
|
|
|
|
(define-key esc-map ">" 'end-of-buffer)
|
|
|
|
|
(define-key ctl-x-map "h" 'mark-whole-buffer)
|
|
|
|
|
(define-key esc-map "\\" 'delete-horizontal-space)
|
|
|
|
|
|
|
|
|
|
(defalias 'mode-specific-command-prefix (make-sparse-keymap))
|
1996-12-16 02:42:28 +00:00
|
|
|
|
(defvar mode-specific-map (symbol-function 'mode-specific-command-prefix)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
"Keymap for characters following C-c.")
|
|
|
|
|
(define-key global-map "\C-c" 'mode-specific-command-prefix)
|
|
|
|
|
|
2011-10-07 16:05:10 +00:00
|
|
|
|
(global-set-key [M-right] 'right-word)
|
2005-06-11 07:14:38 +00:00
|
|
|
|
(define-key esc-map [right] 'forward-word)
|
2011-10-07 16:05:10 +00:00
|
|
|
|
(global-set-key [M-left] 'left-word)
|
2005-06-11 07:14:38 +00:00
|
|
|
|
(define-key esc-map [left] 'backward-word)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
;; ilya@math.ohio-state.edu says these bindings are standard on PC editors.
|
2010-05-29 15:19:13 +00:00
|
|
|
|
(global-set-key [C-right] 'right-word)
|
|
|
|
|
(global-set-key [C-left] 'left-word)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
;; This is not quite compatible, but at least is analogous
|
2009-01-27 20:09:47 +00:00
|
|
|
|
(global-set-key [C-delete] 'kill-word)
|
|
|
|
|
(global-set-key [C-backspace] 'backward-kill-word)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
;; This is "move to the clipboard", or as close as we come.
|
|
|
|
|
(global-set-key [S-delete] 'kill-region)
|
|
|
|
|
|
2005-06-11 07:14:38 +00:00
|
|
|
|
(global-set-key [C-M-left] 'backward-sexp)
|
|
|
|
|
(define-key esc-map [C-left] 'backward-sexp)
|
|
|
|
|
(global-set-key [C-M-right] 'forward-sexp)
|
|
|
|
|
(define-key esc-map [C-right] 'forward-sexp)
|
|
|
|
|
(global-set-key [C-M-up] 'backward-up-list)
|
|
|
|
|
(define-key esc-map [C-up] 'backward-up-list)
|
|
|
|
|
(global-set-key [C-M-down] 'down-list)
|
|
|
|
|
(define-key esc-map [C-down] 'down-list)
|
|
|
|
|
(global-set-key [C-M-home] 'beginning-of-defun)
|
|
|
|
|
(define-key esc-map [C-home] 'beginning-of-defun)
|
|
|
|
|
(global-set-key [C-M-end] 'end-of-defun)
|
|
|
|
|
(define-key esc-map [C-end] 'end-of-defun)
|
2004-05-01 03:50:24 +00:00
|
|
|
|
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key esc-map "\C-f" 'forward-sexp)
|
|
|
|
|
(define-key esc-map "\C-b" 'backward-sexp)
|
|
|
|
|
(define-key esc-map "\C-u" 'backward-up-list)
|
|
|
|
|
(define-key esc-map "\C-@" 'mark-sexp)
|
|
|
|
|
(define-key esc-map [?\C-\ ] 'mark-sexp)
|
|
|
|
|
(define-key esc-map "\C-d" 'down-list)
|
|
|
|
|
(define-key esc-map "\C-k" 'kill-sexp)
|
2003-06-03 11:04:06 +00:00
|
|
|
|
;;; These are dangerous in various situations,
|
|
|
|
|
;;; so let's not encourage anyone to use them.
|
|
|
|
|
;;;(define-key global-map [C-M-delete] 'backward-kill-sexp)
|
|
|
|
|
;;;(define-key global-map [C-M-backspace] 'backward-kill-sexp)
|
2000-08-18 06:28:47 +00:00
|
|
|
|
(define-key esc-map [C-delete] 'backward-kill-sexp)
|
|
|
|
|
(define-key esc-map [C-backspace] 'backward-kill-sexp)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key esc-map "\C-n" 'forward-list)
|
|
|
|
|
(define-key esc-map "\C-p" 'backward-list)
|
|
|
|
|
(define-key esc-map "\C-a" 'beginning-of-defun)
|
|
|
|
|
(define-key esc-map "\C-e" 'end-of-defun)
|
|
|
|
|
(define-key esc-map "\C-h" 'mark-defun)
|
|
|
|
|
(define-key ctl-x-map "nd" 'narrow-to-defun)
|
|
|
|
|
(define-key esc-map "(" 'insert-parentheses)
|
|
|
|
|
(define-key esc-map ")" 'move-past-close-and-reindent)
|
|
|
|
|
|
|
|
|
|
(define-key ctl-x-map "\C-e" 'eval-last-sexp)
|
1997-04-29 02:07:34 +00:00
|
|
|
|
|
|
|
|
|
(define-key ctl-x-map "m" 'compose-mail)
|
|
|
|
|
(define-key ctl-x-4-map "m" 'compose-mail-other-window)
|
|
|
|
|
(define-key ctl-x-5-map "m" 'compose-mail-other-frame)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
2008-06-30 19:37:02 +00:00
|
|
|
|
|
2012-07-14 02:19:07 +00:00
|
|
|
|
(defvar ctl-x-r-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(define-key map "c" 'clear-rectangle)
|
|
|
|
|
(define-key map "k" 'kill-rectangle)
|
|
|
|
|
(define-key map "d" 'delete-rectangle)
|
|
|
|
|
(define-key map "y" 'yank-rectangle)
|
|
|
|
|
(define-key map "o" 'open-rectangle)
|
|
|
|
|
(define-key map "t" 'string-rectangle)
|
|
|
|
|
(define-key map "N" 'rectangle-number-lines)
|
|
|
|
|
(define-key map "\M-w" 'copy-rectangle-as-kill)
|
|
|
|
|
(define-key map "\C-@" 'point-to-register)
|
|
|
|
|
(define-key map [?\C-\ ] 'point-to-register)
|
|
|
|
|
(define-key map " " 'point-to-register)
|
|
|
|
|
(define-key map "j" 'jump-to-register)
|
|
|
|
|
(define-key map "s" 'copy-to-register)
|
|
|
|
|
(define-key map "x" 'copy-to-register)
|
|
|
|
|
(define-key map "i" 'insert-register)
|
|
|
|
|
(define-key map "g" 'insert-register)
|
|
|
|
|
(define-key map "r" 'copy-rectangle-to-register)
|
|
|
|
|
(define-key map "n" 'number-to-register)
|
|
|
|
|
(define-key map "+" 'increment-register)
|
|
|
|
|
(define-key map "w" 'window-configuration-to-register)
|
2013-08-08 00:44:22 +00:00
|
|
|
|
(define-key map "f" 'frameset-to-register)
|
2012-07-14 02:19:07 +00:00
|
|
|
|
map)
|
2008-06-30 19:37:02 +00:00
|
|
|
|
"Keymap for subcommands of C-x r.")
|
|
|
|
|
(define-key ctl-x-map "r" ctl-x-r-map)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
2007-10-18 00:07:04 +00:00
|
|
|
|
(define-key esc-map "q" 'fill-paragraph)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key ctl-x-map "." 'set-fill-prefix)
|
|
|
|
|
|
|
|
|
|
(define-key esc-map "{" 'backward-paragraph)
|
|
|
|
|
(define-key esc-map "}" 'forward-paragraph)
|
|
|
|
|
(define-key esc-map "h" 'mark-paragraph)
|
|
|
|
|
(define-key esc-map "a" 'backward-sentence)
|
|
|
|
|
(define-key esc-map "e" 'forward-sentence)
|
|
|
|
|
(define-key esc-map "k" 'kill-sentence)
|
|
|
|
|
(define-key ctl-x-map "\177" 'backward-kill-sentence)
|
|
|
|
|
|
|
|
|
|
(define-key ctl-x-map "[" 'backward-page)
|
|
|
|
|
(define-key ctl-x-map "]" 'forward-page)
|
|
|
|
|
(define-key ctl-x-map "\C-p" 'mark-page)
|
|
|
|
|
(define-key ctl-x-map "l" 'count-lines-page)
|
|
|
|
|
(define-key ctl-x-map "np" 'narrow-to-page)
|
|
|
|
|
;; (define-key ctl-x-map "p" 'narrow-to-page)
|
|
|
|
|
|
2008-06-30 19:37:02 +00:00
|
|
|
|
(defvar abbrev-map (make-sparse-keymap)
|
|
|
|
|
"Keymap for abbrev commands.")
|
|
|
|
|
(define-key ctl-x-map "a" abbrev-map)
|
|
|
|
|
|
|
|
|
|
(define-key abbrev-map "l" 'add-mode-abbrev)
|
|
|
|
|
(define-key abbrev-map "\C-a" 'add-mode-abbrev)
|
|
|
|
|
(define-key abbrev-map "g" 'add-global-abbrev)
|
|
|
|
|
(define-key abbrev-map "+" 'add-mode-abbrev)
|
|
|
|
|
(define-key abbrev-map "ig" 'inverse-add-global-abbrev)
|
|
|
|
|
(define-key abbrev-map "il" 'inverse-add-mode-abbrev)
|
|
|
|
|
;; (define-key abbrev-map "\C-h" 'inverse-add-global-abbrev)
|
|
|
|
|
(define-key abbrev-map "-" 'inverse-add-global-abbrev)
|
|
|
|
|
(define-key abbrev-map "e" 'expand-abbrev)
|
|
|
|
|
(define-key abbrev-map "'" 'expand-abbrev)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
;; (define-key ctl-x-map "\C-a" 'add-mode-abbrev)
|
2015-09-17 23:08:20 +00:00
|
|
|
|
;; (define-key ctl-x-map "+" 'add-global-abbrev)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
;; (define-key ctl-x-map "\C-h" 'inverse-add-mode-abbrev)
|
2015-09-17 23:08:20 +00:00
|
|
|
|
;; (define-key ctl-x-map "-" 'inverse-add-global-abbrev)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
(define-key esc-map "'" 'abbrev-prefix-mark)
|
|
|
|
|
(define-key ctl-x-map "'" 'expand-abbrev)
|
2012-05-06 08:43:46 +00:00
|
|
|
|
(define-key ctl-x-map "\C-b" 'list-buffers)
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
2020-09-12 01:42:37 +00:00
|
|
|
|
(define-key ctl-x-map "\C-j" 'dired-jump)
|
|
|
|
|
(define-key ctl-x-4-map "\C-j" 'dired-jump-other-window)
|
|
|
|
|
|
1998-06-10 18:55:56 +00:00
|
|
|
|
(define-key ctl-x-map "z" 'repeat)
|
1998-05-14 21:16:49 +00:00
|
|
|
|
|
2021-02-07 12:30:33 +00:00
|
|
|
|
(defvar ctl-x-x-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
2021-03-18 04:10:32 +00:00
|
|
|
|
(define-key map "f" #'font-lock-update)
|
2021-02-07 12:30:33 +00:00
|
|
|
|
(define-key map "g" #'revert-buffer)
|
2021-02-07 12:53:44 +00:00
|
|
|
|
(define-key map "r" #'rename-buffer)
|
|
|
|
|
(define-key map "u" #'rename-uniquely)
|
2021-02-08 06:52:16 +00:00
|
|
|
|
(define-key map "n" #'clone-buffer)
|
2021-02-07 12:53:44 +00:00
|
|
|
|
(define-key map "i" #'insert-buffer)
|
|
|
|
|
(define-key map "t" #'toggle-truncate-lines)
|
2021-02-07 12:30:33 +00:00
|
|
|
|
map)
|
|
|
|
|
"Keymap for subcommands of C-x x.")
|
|
|
|
|
(define-key ctl-x-map "x" ctl-x-x-map)
|
2021-02-02 08:44:44 +00:00
|
|
|
|
|
2007-11-15 12:09:11 +00:00
|
|
|
|
(define-key esc-map "\C-l" 'reposition-window)
|
|
|
|
|
|
|
|
|
|
(define-key ctl-x-4-map "a" 'add-change-log-entry-other-window)
|
2005-04-19 09:25:32 +00:00
|
|
|
|
(define-key ctl-x-4-map "c" 'clone-indirect-buffer-other-window)
|
|
|
|
|
|
2006-12-04 12:31:38 +00:00
|
|
|
|
;; Signal handlers
|
2006-12-19 15:38:42 +00:00
|
|
|
|
(define-key special-event-map [sigusr1] 'ignore)
|
|
|
|
|
(define-key special-event-map [sigusr2] 'ignore)
|
2006-12-04 12:31:38 +00:00
|
|
|
|
|
2001-11-17 00:27:08 +00:00
|
|
|
|
;; Don't look for autoload cookies in this file.
|
|
|
|
|
;; Local Variables:
|
|
|
|
|
;; no-update-autoloads: t
|
|
|
|
|
;; End:
|
1996-09-11 19:05:36 +00:00
|
|
|
|
|
|
|
|
|
;;; bindings.el ends here
|