Using saved parent location: http://bzr.savannah.gnu.org/r/emacs/trunk/ Now on revision 100655. ------------------------------------------------------------ revno: 100655 [merge] committer: Kenichi Handa branch nick: trunk timestamp: Mon 2010-06-28 14:42:39 +0900 message: international/quail.el (quail-insert-kbd-layout): Fix the showing of untranslated characters. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-06-28 01:01:11 +0000 +++ lisp/ChangeLog 2010-06-28 05:41:36 +0000 @@ -1,3 +1,8 @@ +2010-06-28 Kenichi Handa + + * international/quail.el (quail-insert-kbd-layout): Fix the + showing of untranslated characters. + 2010-06-28 Chong Yidong * simple.el (delete-active-region): New option. === modified file 'lisp/international/quail.el' --- lisp/international/quail.el 2010-01-13 08:35:10 +0000 +++ lisp/international/quail.el 2010-06-28 05:41:36 +0000 @@ -811,7 +811,7 @@ (setq translation (aref (cdr translation) 0)) (setq translation " "))) (setq done-list (cons translation done-list))) - (setq translation ch)) + (setq translation (aref kbd-layout i))) (aset layout i translation)) (setq i (1+ i))) ------------------------------------------------------------ revno: 100654 committer: Chong Yidong branch nick: trunk timestamp: Sun 2010-06-27 21:01:11 -0400 message: * bindings.el (global-map): Bind delete and DEL, the former to delete-forward-char. * mouse.el (mouse-region-delete-keys): Deleted. (mouse-show-mark): Simplify. * simple.el (delete-active-region): New option. (delete-backward-char): Implement in Lisp. (delete-forward-char): New command. * src/cmds.c (Fdelete_backward_char): Move into Lisp. diff: === modified file 'etc/NEWS' --- etc/NEWS 2010-06-27 00:30:52 +0000 +++ etc/NEWS 2010-06-28 01:01:11 +0000 @@ -144,6 +144,25 @@ ** completion-at-point is now an alias for complete-symbol. ** mouse-region-delete-keys has been deleted. + +** Deletion changes + +*** New option `delete-active-region'. +If non-nil, C-d, [delete], and DEL delete the region if it is active +and no prefix argument is given. If set to `kill', these commands +kill instead. + +*** New command `delete-forward-char', bound to C-d and [delete]. +This is meant for interactive use, and obeys `delete-active-region'; +delete-char, meant for Lisp, does not obey `delete-active-region'. + +*** `delete-backward-char' is now a Lisp function. +Apart from obeying `delete-active-region', its behavior is unchanged. +However, the byte compiler now warns if it is called from Lisp; you +should use delete-char with a negative argument instead. + +*** The option `mouse-region-delete-keys' has been deleted. + * Changes in Specialized Modes and Packages in Emacs 24.1 === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-06-27 18:18:49 +0000 +++ lisp/ChangeLog 2010-06-28 01:01:11 +0000 @@ -1,3 +1,15 @@ +2010-06-28 Chong Yidong + + * simple.el (delete-active-region): New option. + (delete-backward-char): Implement in Lisp. + (delete-forward-char): New command. + + * mouse.el (mouse-region-delete-keys): Deleted. + (mouse-show-mark): Simplify. + + * bindings.el (global-map): Bind delete and DEL, the former to + delete-forward-char. + 2010-01-16 Lennart Borgman * progmodes/ruby-mode.el (ruby-mode-map): Don't bind TAB. === modified file 'lisp/bindings.el' --- lisp/bindings.el 2010-05-29 15:19:13 +0000 +++ lisp/bindings.el 2010-06-28 01:01:11 +0000 @@ -822,6 +822,9 @@ (setq i (1+ i)))) (define-key global-map [?\C-\M--] 'negative-argument) +(define-key global-map "\177" 'delete-backward-char) +(define-key global-map "\C-d" 'delete-forward-char) + (define-key global-map "\C-k" 'kill-line) (define-key global-map "\C-w" 'kill-region) (define-key esc-map "w" 'kill-ring-save) === modified file 'lisp/mouse.el' --- lisp/mouse.el 2010-01-13 08:35:10 +0000 +++ lisp/mouse.el 2010-06-28 01:01:11 +0000 @@ -929,7 +929,7 @@ (mouse-minibuffer-check start-event) (setq mouse-selection-click-count-buffer (current-buffer)) ;; We must call deactivate-mark before repositioning point. - ;; Otherwise, for select-active-regions non-nil, we get the wrong + ;; Otherwise, for `select-active-regions' non-nil, we get the wrong ;; selection if the user drags a region, clicks elsewhere to ;; reposition point, then middle-clicks to paste the selection. (deactivate-mark) @@ -1263,11 +1263,6 @@ ;; Momentarily show where the mark is, if highlighting doesn't show it. -(defcustom mouse-region-delete-keys '([delete] [deletechar] [backspace]) - "List of keys that should cause the mouse region to be deleted." - :group 'mouse - :type '(repeat key-sequence)) - (defun mouse-show-mark () (let ((inhibit-quit t) (echo-keystrokes 0) @@ -1297,8 +1292,7 @@ 'vertical-scroll-bar)) (and (memq 'down (event-modifiers event)) (not (key-binding key)) - (not (mouse-undouble-last-event events)) - (not (member key mouse-region-delete-keys))))) + (not (mouse-undouble-last-event events))))) (and (consp event) (or (eq (car event) 'switch-frame) (eq (posn-point (event-end event)) @@ -1311,22 +1305,9 @@ (setq events nil))))))) ;; If we lost the selection, just turn off the highlighting. (unless ignore - ;; For certain special keys, delete the region. - (if (member key mouse-region-delete-keys) - (progn - ;; Since notionally this is a separate command, - ;; run all the hooks that would be run if it were - ;; executed separately. - (run-hooks 'post-command-hook) - (setq last-command this-command) - (setq this-original-command 'delete-region) - (setq this-command (or (command-remapping this-original-command) - this-original-command)) - (run-hooks 'pre-command-hook) - (call-interactively this-command)) - ;; Otherwise, unread the key so it gets executed normally. - (setq unread-command-events - (nconc events unread-command-events)))) + ;; Unread the key so it gets executed normally. + (setq unread-command-events + (nconc events unread-command-events))) (setq quit-flag nil) (unless transient-mark-mode (delete-overlay mouse-drag-overlay)))) === modified file 'lisp/simple.el' --- lisp/simple.el 2010-06-21 23:26:46 +0000 +++ lisp/simple.el 2010-06-28 01:01:11 +0000 @@ -844,6 +844,78 @@ (overlay-recenter (point)) (recenter -3)))) +(defcustom delete-active-region t + "Whether single-char deletion commands delete an active region. +This has an effect only if Transient Mark mode is enabled, and +affects `delete-forward-char' and `delete-backward-char', though +not `delete-char'. + +If the value is the symbol `kill', the active region is killed +instead of deleted." + :type '(choice (const :tag "Delete active region" t) + (const :tag "Kill active region" kill) + (const :tag "Do ordinary deletion" nil)) + :group 'editing + :version "24.1") + +(defun delete-backward-char (n &optional killflag) + "Delete the previous N characters (following if N is negative). +If Transient Mark mode is enabled, the mark is active, and N is 1, +delete the text in the region and deactivate the mark instead. +To disable this, set `delete-active-region' to nil. + +Optional second arg KILLFLAG, if non-nil, means to kill (save in +kill ring) instead of delete. Interactively, N is the prefix +arg, and KILLFLAG is set if N is explicitly specified. + +In Overwrite mode, single character backward deletion may replace +tabs with spaces so as to back over columns, unless point is at +the end of the line." + (interactive "p\nP") + (unless (integerp n) + (signal 'wrong-type-argument (list 'integerp n))) + (cond ((and (use-region-p) + delete-active-region + (= n 1)) + ;; If a region is active, kill or delete it. + (if (eq delete-active-region 'kill) + (kill-region (region-beginning) (region-end)) + (delete-region (region-beginning) (region-end)))) + ;; In Overwrite mode, maybe untabify while deleting + ((null (or (null overwrite-mode) + (<= n 0) + (memq (char-before) '(?\t ?\n)) + (eobp) + (eq (char-after) ?\n))) + (let* ((ocol (current-column)) + (val (delete-char (- n) killflag))) + (save-excursion + (insert-char ?\s (- ocol (current-column)) nil)))) + ;; Otherwise, do simple deletion. + (t (delete-char (- n) killflag)))) + +(defun delete-forward-char (n &optional killflag) + "Delete the previous N characters (following if N is negative). +If Transient Mark mode is enabled, the mark is active, and N is 1, +delete the text in the region and deactivate the mark instead. +To disable this, set `delete-active-region' to nil. + +Optional second arg KILLFLAG non-nil means to kill (save in kill +ring) instead of delete. Interactively, N is the prefix arg, and +KILLFLAG is set if N was explicitly specified." + (interactive "p\nP") + (unless (integerp n) + (signal 'wrong-type-argument (list 'integerp n))) + (cond ((and (use-region-p) + delete-active-region + (= n 1)) + ;; If a region is active, kill or delete it. + (if (eq delete-active-region 'kill) + (kill-region (region-beginning) (region-end)) + (delete-region (region-beginning) (region-end)))) + ;; Otherwise, do simple deletion. + (t (delete-char n killflag)))) + (defun mark-whole-buffer () "Put point at beginning and mark at end of buffer. You probably should not use this function in Lisp programs; === modified file 'src/ChangeLog' --- src/ChangeLog 2010-06-27 21:28:51 +0000 +++ src/ChangeLog 2010-06-28 01:01:11 +0000 @@ -1,3 +1,7 @@ +2010-06-28 Chong Yidong + + * cmds.c (Fdelete_backward_char): Move into Lisp. + 2010-06-27 Dan Nicolaescu * s/freebsd.h (BSD4_2): Remove redundant definition. === modified file 'src/cmds.c' --- src/cmds.c 2010-06-07 10:35:57 +0000 +++ src/cmds.c 2010-06-28 01:01:11 +0000 @@ -240,7 +240,9 @@ doc: /* Delete the following N characters (previous if N is negative). Optional second arg KILLFLAG non-nil means kill instead (save in kill ring). Interactively, N is the prefix arg, and KILLFLAG is set if -N was explicitly specified. */) +N was explicitly specified. + +The command `delete-forward' is preferable for interactive use. */) (n, killflag) Lisp_Object n, killflag; { @@ -273,60 +275,6 @@ return Qnil; } -DEFUN ("delete-backward-char", Fdelete_backward_char, Sdelete_backward_char, - 1, 2, "p\nP", - doc: /* Delete the previous N characters (following if N is negative). -Optional second arg KILLFLAG non-nil means kill instead (save in kill ring). -Interactively, N is the prefix arg, and KILLFLAG is set if -N was explicitly specified. -This is meant for interactive use only; from Lisp, better use `delete-char' -with a negated argument. */) - (n, killflag) - Lisp_Object n, killflag; -{ - Lisp_Object value; - int deleted_special = 0; - int pos, pos_byte, i; - - CHECK_NUMBER (n); - - /* See if we are about to delete a tab or newline backwards. */ - pos = PT; - pos_byte = PT_BYTE; - for (i = 0; i < XINT (n) && pos_byte > BEGV_BYTE; i++) - { - int c; - - DEC_BOTH (pos, pos_byte); - c = FETCH_BYTE (pos_byte); - if (c == '\t' || c == '\n') - { - deleted_special = 1; - break; - } - } - - /* In overwrite mode, back over columns while clearing them out, - unless at end of line. */ - if (XINT (n) > 0 - && ! NILP (current_buffer->overwrite_mode) - && ! deleted_special - && ! (PT == ZV || FETCH_BYTE (PT_BYTE) == '\n')) - { - int column = (int) current_column (); /* iftc */ - - value = Fdelete_char (make_number (-XINT (n)), killflag); - i = column - (int) current_column (); /* iftc */ - Finsert_char (make_number (' '), make_number (i), Qnil); - /* Whitespace chars are ASCII chars, so we can simply subtract. */ - SET_PT_BOTH (PT - i, PT_BYTE - i); - } - else - value = Fdelete_char (make_number (-XINT (n)), killflag); - - return value; -} - static int nonundocount; /* Note that there's code in command_loop_1 which typically avoids @@ -635,8 +583,6 @@ defsubr (&Send_of_line); defsubr (&Sdelete_char); - defsubr (&Sdelete_backward_char); - defsubr (&Sself_insert_command); } @@ -658,10 +604,8 @@ initial_define_key (global_map, Ctl ('A'), "beginning-of-line"); initial_define_key (global_map, Ctl ('B'), "backward-char"); - initial_define_key (global_map, Ctl ('D'), "delete-char"); initial_define_key (global_map, Ctl ('E'), "end-of-line"); initial_define_key (global_map, Ctl ('F'), "forward-char"); - initial_define_key (global_map, 0177, "delete-backward-char"); } /* arch-tag: 022ba3cd-67f9-4978-9c5d-7d2b18d8644e ------------------------------------------------------------ revno: 100653 committer: Dan Nicolaescu branch nick: trunk timestamp: Sun 2010-06-27 14:28:51 -0700 message: * src/s/freebsd.h (BSD4_2): Remove redundant definition. bsd-common.h defines it already. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2010-06-27 00:30:52 +0000 +++ src/ChangeLog 2010-06-27 21:28:51 +0000 @@ -1,3 +1,8 @@ +2010-06-27 Dan Nicolaescu + + * s/freebsd.h (BSD4_2): Remove redundant definition. + bsd-common.h defines it already. + 2010-06-27 Chong Yidong * xfns.c (Fx_create_frame): Don't consult X resouces when setting === modified file 'src/s/freebsd.h' --- src/s/freebsd.h 2010-05-12 06:53:03 +0000 +++ src/s/freebsd.h 2010-06-27 21:28:51 +0000 @@ -25,9 +25,6 @@ /* Get most of the stuff from bsd-common */ #include "bsd-common.h" -/* For mem-limits.h. */ -#define BSD4_2 - #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base) #define HAVE_GETLOADAVG 1 ------------------------------------------------------------ revno: 100652 committer: Chong Yidong branch nick: trunk timestamp: Sun 2010-06-27 14:18:49 -0400 message: * progmodes/ruby-mode.el (ruby-mode-map): Don't bind TAB. (ruby-mode): Bind indent-line-function (Bug#5119). diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-06-27 18:11:16 +0000 +++ lisp/ChangeLog 2010-06-27 18:18:49 +0000 @@ -1,3 +1,8 @@ +2010-01-16 Lennart Borgman + + * progmodes/ruby-mode.el (ruby-mode-map): Don't bind TAB. + (ruby-mode): Bind indent-line-function (Bug#5119). + 2010-06-27 Chong Yidong * startup.el (command-line): Recognize "0" X resource value. === modified file 'lisp/progmodes/ruby-mode.el' --- lisp/progmodes/ruby-mode.el 2010-01-13 08:35:10 +0000 +++ lisp/progmodes/ruby-mode.el 2010-06-27 18:18:49 +0000 @@ -166,7 +166,6 @@ (define-key map (kbd "M-C-n") 'ruby-end-of-block) (define-key map (kbd "M-C-h") 'ruby-mark-defun) (define-key map (kbd "M-C-q") 'ruby-indent-exp) - (define-key map (kbd "TAB") 'ruby-indent-line) (define-key map (kbd "C-M-h") 'backward-kill-word) (define-key map (kbd "C-j") 'reindent-then-newline-and-indent) (define-key map (kbd "C-m") 'newline) @@ -1390,6 +1389,8 @@ (setq major-mode 'ruby-mode) (ruby-mode-variables) + (set (make-local-variable 'indent-line-function) + 'ruby-indent-line) (set (make-local-variable 'imenu-create-index-function) 'ruby-imenu-create-index) (set (make-local-variable 'add-log-current-defun-function) ------------------------------------------------------------ revno: 100651 committer: Chong Yidong branch nick: trunk timestamp: Sun 2010-06-27 14:11:16 -0400 message: * startup.el (command-line): Recognize "0" X resource value. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-06-27 00:30:52 +0000 +++ lisp/ChangeLog 2010-06-27 18:11:16 +0000 @@ -1,5 +1,9 @@ 2010-06-27 Chong Yidong + * startup.el (command-line): Recognize "0" X resource value. + +2010-06-27 Chong Yidong + * startup.el (command-line): Use X resources to set the value of menu-bar-mode and tool-bar-mode, before calling frame-initialize. === modified file 'lisp/startup.el' --- lisp/startup.el 2010-06-27 00:30:52 +0000 +++ lisp/startup.el 2010-06-27 18:11:16 +0000 @@ -889,7 +889,7 @@ no-blinking-cursor t)) ;; Check X resources if available. ((memq initial-window-system '(x w32 ns)) - (let ((no-vals '("no" "off" "false"))) + (let ((no-vals '("no" "off" "false" "0"))) (if (member (x-get-resource "menuBar" "MenuBar") no-vals) (setq menu-bar-mode nil)) (if (member (x-get-resource "toolBar" "ToolBar") no-vals) ------------------------------------------------------------ revno: 100650 committer: Chong Yidong branch nick: trunk timestamp: Sat 2010-06-26 20:30:52 -0400 message: Change default-frame-alist and menu/tool-bar-mode interaction (Bug#2249). Don't add entries for `menu-bar-lines' and `tool-bar-lines' to `default-frame-alist' and `initial-frame-alist' at startup. Instead, use X resources to update the `menu-bar-mode' and `tool-bar-mode' variables at startup, and use them as defaults during frame creation. * lisp/frame.el (frame-notice-user-settings): Don't change default-frame-alist based on menu-bar-mode and tool-bar-mode, or vice versa. * lisp/menu-bar.el (menu-bar-mode): * lisp/tool-bar.el (tool-bar-mode): Don't change default-frame-alist. Set init-value to t. * lisp/startup.el (command-line): Use X resources to set the value of menu-bar-mode and tool-bar-mode, before calling frame-initialize. * src/frame.c (Vmenu_bar_mode, Vtool_bar_mode): New vars. * src/w32fns.c (Fx_create_frame): * src/nsfns.m (Fx_create_frame): Likewise. * src/xfns.c (Fx_create_frame): Don't consult X resouces when setting menu-bar-lines and tool-bar-lines. Use menu-bar-mode and tool-bar-mode, which are now set using these X resources at startup, to determine the defaults. diff: === modified file 'etc/NEWS' --- etc/NEWS 2010-06-17 02:08:10 +0000 +++ etc/NEWS 2010-06-27 00:30:52 +0000 @@ -275,6 +275,15 @@ ** Passing a nil argument to a minor mode function now turns the mode ON unconditionally. + +** During startup, Emacs no longer adds entries for `menu-bar-lines' +and `tool-bar-lines' to `default-frame-alist' and +`initial-frame-alist'. With these alist entries omitted, `make-frame' +checks the value of the variable `menu-bar-mode'/`tool-bar-mode' to +determine whether to create a menu-bar or tool-bar, respectively. +If the alist entries are added, they override the value of +`menu-bar-mode'/`tool-bar-mode'. + * Lisp changes in Emacs 24.1 === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-06-26 12:11:06 +0000 +++ lisp/ChangeLog 2010-06-27 00:30:52 +0000 @@ -1,3 +1,16 @@ +2010-06-27 Chong Yidong + + * startup.el (command-line): Use X resources to set the value of + menu-bar-mode and tool-bar-mode, before calling frame-initialize. + + * menu-bar.el (menu-bar-mode): + * tool-bar.el (tool-bar-mode): Don't change default-frame-alist. + Set init-value to t. + + * frame.el (frame-notice-user-settings): Don't change + default-frame-alist based on menu-bar-mode and tool-bar-mode, or + vice versa (Bug#2249). + 2010-06-26 Eli Zaretskii * w32-fns.el (w32-convert-standard-filename): Doc fix. === modified file 'lisp/frame.el' --- lisp/frame.el 2010-06-25 19:32:37 +0000 +++ lisp/frame.el 2010-06-27 00:30:52 +0000 @@ -39,13 +39,6 @@ (defvar window-system-default-frame-alist nil "Alist of window-system dependent default frame parameters. -You can set this in your init file; for example, - - ;; Disable menubar and toolbar on the console, but enable them under X. - (setq window-system-default-frame-alist - '((x (menu-bar-lines . 1) (tool-bar-lines . 1)) - (nil (menu-bar-lines . 0) (tool-bar-lines . 0)))) - Parameters specified here supersede the values given in `default-frame-alist'.") @@ -287,36 +280,6 @@ React to settings of `initial-frame-alist', `window-system-default-frame-alist' and `default-frame-alist' there (in decreasing order of priority)." - ;; Make menu-bar-mode and default-frame-alist consistent. - (when (boundp 'menu-bar-mode) - (let ((default (assq 'menu-bar-lines default-frame-alist))) - (if default - (setq menu-bar-mode (not (eq (cdr default) 0))) - (setq default-frame-alist - (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0)) - default-frame-alist))))) - - ;; Make tool-bar-mode and default-frame-alist consistent. Don't do - ;; it in batch mode since that would leave a tool-bar-lines - ;; parameter in default-frame-alist in a dumped Emacs, which is not - ;; what we want. - (when (and (boundp 'tool-bar-mode) - (not noninteractive)) - (let ((default (assq 'tool-bar-lines default-frame-alist))) - (if default - (setq tool-bar-mode (not (eq (cdr default) 0))) - ;; If Emacs was started on a tty, changing default-frame-alist - ;; would disable the toolbar on X frames created later. We - ;; want to keep the default of showing a toolbar under X even - ;; in this case. - ;; - ;; If the user explicitly called `tool-bar-mode' in .emacs, - ;; then default-frame-alist is already changed anyway. - (when initial-window-system - (setq default-frame-alist - (cons (cons 'tool-bar-lines (if tool-bar-mode 1 0)) - default-frame-alist)))))) - ;; Creating and deleting frames may shift the selected frame around, ;; and thus the current buffer. Protect against that. We don't ;; want to use save-excursion here, because that may also try to set === modified file 'lisp/menu-bar.el' --- lisp/menu-bar.el 2010-06-19 22:36:51 +0000 +++ lisp/menu-bar.el 2010-06-27 00:30:52 +0000 @@ -1924,28 +1924,20 @@ `(menu-item ,(purecopy "Previous History Item") previous-history-element :help ,(purecopy "Put previous minibuffer history element in the minibuffer")))) -;;;###autoload -;; This comment is taken from tool-bar.el near -;; (put 'tool-bar-mode ...) -;; We want to pretend the menu bar by standard is on, as this will make -;; customize consider disabling the menu bar a customization, and save -;; that. We could do this for real by setting :init-value below, but -;; that would overwrite disabling the tool bar from X resources. -(put 'menu-bar-mode 'standard-value '(t)) - (define-minor-mode menu-bar-mode "Toggle display of a menu bar on each frame. This command applies to all frames that exist and frames to be created in the future. With a numeric argument, if the argument is positive, turn on menu bars; otherwise, turn off menu bars." - :init-value nil + :init-value t :global t :group 'frames - ;; Make menu-bar-mode and default-frame-alist consistent. - (modify-all-frames-parameters (list (cons 'menu-bar-lines - (if menu-bar-mode 1 0)))) + ;; Turn the menu-bars on all frames on or off. + (let ((val (if menu-bar-mode 1 0))) + (dolist (frame (frame-list)) + (set-frame-parameter frame 'menu-bar-lines val))) ;; Make the message appear when Emacs is idle. We can not call message ;; directly. The minor-mode message "Menu-bar mode disabled" comes === modified file 'lisp/startup.el' --- lisp/startup.el 2010-06-17 02:08:10 +0000 +++ lisp/startup.el 2010-06-27 00:30:52 +0000 @@ -878,10 +878,32 @@ (run-hooks 'before-init-hook) - ;; Under X Window, this creates the X frame and deletes the terminal frame. + ;; Under X, this creates the X frame and deletes the terminal frame. (unless (daemonp) + ;; Enable or disable the tool-bar and menu-bar. + ;; While we're at it, set `no-blinking-cursor' too. + (cond + ((or noninteractive emacs-basic-display) + (setq menu-bar-mode nil + tool-bar-mode nil + no-blinking-cursor t)) + ;; Check X resources if available. + ((memq initial-window-system '(x w32 ns)) + (let ((no-vals '("no" "off" "false"))) + (if (member (x-get-resource "menuBar" "MenuBar") no-vals) + (setq menu-bar-mode nil)) + (if (member (x-get-resource "toolBar" "ToolBar") no-vals) + (setq tool-bar-mode nil)) + (if (member (x-get-resource "cursorBlink" "CursorBlink") + no-vals) + (setq no-blinking-cursor t))))) (frame-initialize)) + ;; Set up the tool-bar (even in tty frames, since Emacs might open a + ;; graphical frame later). + (unless noninteractive + (tool-bar-setup)) + ;; Turn off blinking cursor if so specified in X resources. This is here ;; only because all other settings of no-blinking-cursor are here. (unless (or noninteractive @@ -891,25 +913,6 @@ '("off" "false"))))) (setq no-blinking-cursor t)) - ;; If frame was created with a menu bar, set menu-bar-mode on. - (unless (or noninteractive - emacs-basic-display - (and (memq initial-window-system '(x w32)) - (<= (frame-parameter nil 'menu-bar-lines) 0))) - (menu-bar-mode 1)) - - (unless (or noninteractive (not (fboundp 'tool-bar-mode))) - ;; Set up the tool-bar. Do this even in tty frames, so that there - ;; is a tool-bar if Emacs later opens a graphical frame. - (if (or emacs-basic-display - (and (numberp (frame-parameter nil 'tool-bar-lines)) - (<= (frame-parameter nil 'tool-bar-lines) 0))) - ;; On a graphical display with the toolbar disabled via X - ;; resources, set up the toolbar without enabling it. - (tool-bar-setup) - ;; Otherwise, enable tool-bar-mode. - (tool-bar-mode 1))) - ;; Re-evaluate predefined variables whose initial value depends on ;; the runtime context. (mapc 'custom-reevaluate-setting === modified file 'lisp/tool-bar.el' --- lisp/tool-bar.el 2010-04-25 07:23:01 +0000 +++ lisp/tool-bar.el 2010-06-27 00:30:52 +0000 @@ -48,21 +48,17 @@ See `tool-bar-add-item' and `tool-bar-add-item-from-menu' for conveniently adding tool bar items." - :init-value nil + :init-value t :global t :group 'mouse :group 'frames - (if tool-bar-mode - (progn - ;; Make one tool-bar-line for any - including non-graphical - - ;; terminal, see Bug#1754. If this causes problems, we should - ;; handle the problem in `modify-frame-parameters' or do not - ;; call `modify-all-frames-parameters' when toggling the tool - ;; bar off either. - (modify-all-frames-parameters (list (cons 'tool-bar-lines 1))) - (if (= 1 (length (default-value 'tool-bar-map))) ; not yet setup - (tool-bar-setup))) - (modify-all-frames-parameters (list (cons 'tool-bar-lines 0))))) + ;; Make tool-bar even if terminal is non-graphical (Bug#1754). + (let ((val (if tool-bar-mode 1 0))) + (dolist (frame (frame-list)) + (set-frame-parameter frame 'tool-bar-lines val))) + (when tool-bar-mode + (if (= 1 (length (default-value 'tool-bar-map))) ; not yet setup + (tool-bar-setup)))) ;;;###autoload ;; Used in the Show/Hide menu, to have the toggle reflect the current frame. @@ -74,17 +70,6 @@ (tool-bar-mode (if (> (frame-parameter nil 'tool-bar-lines) 0) 0 1)) (tool-bar-mode arg))) -;;;###autoload -;; We want to pretend the toolbar by standard is on, as this will make -;; customize consider disabling the toolbar a customization, and save -;; that. We could do this for real by setting :init-value above, but -;; that would turn on the toolbar in MS Windows where it is currently -;; useless, and it would overwrite disabling the tool bar from X -;; resources. If anyone want to implement this in a cleaner way, -;; please do so. -;; -- Per Abrahamsen 2002-02-21. -(put 'tool-bar-mode 'standard-value '(t)) - (defvar tool-bar-map (make-sparse-keymap) "Keymap for the tool bar. Define this locally to override the global tool bar.") === modified file 'src/ChangeLog' --- src/ChangeLog 2010-06-25 19:32:37 +0000 +++ src/ChangeLog 2010-06-27 00:30:52 +0000 @@ -1,3 +1,15 @@ +2010-06-27 Chong Yidong + + * xfns.c (Fx_create_frame): Don't consult X resouces when setting + menu-bar-lines and tool-bar-lines. Use menu-bar-mode and + tool-bar-mode, which are now set using these X resources at + startup, to determine the defaults (Bug#2249). + + * w32fns.c (Fx_create_frame): + * nsfns.m (Fx_create_frame): Likewise. + + * frame.c (Vmenu_bar_mode, Vtool_bar_mode): New vars. + 2010-06-24 Juanma Barranquero * gtkutil.c (xg_update_scrollbar_pos): === modified file 'src/frame.c' --- src/frame.c 2010-06-25 19:32:37 +0000 +++ src/frame.c 2010-06-27 00:30:52 +0000 @@ -119,6 +119,7 @@ Lisp_Object Qexplicit_name; Lisp_Object Qunsplittable; Lisp_Object Qmenu_bar_lines, Qtool_bar_lines; +Lisp_Object Vmenu_bar_mode, Vtool_bar_mode; Lisp_Object Qleft_fringe, Qright_fringe; Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list; Lisp_Object Qtty_color_mode; @@ -4648,6 +4649,14 @@ Qdelete_frame_functions = intern_c_string ("delete-frame-functions"); staticpro (&Qdelete_frame_functions); + DEFVAR_LISP ("menu-bar-mode", &Vmenu_bar_mode, + doc: /* Non-nil if Menu-Bar mode is enabled. */); + Vmenu_bar_mode = Qt; + + DEFVAR_LISP ("tool-bar-mode", &Vtool_bar_mode, + doc: /* Non-nil if Tool-Bar mode is enabled. */); + Vtool_bar_mode = Qt; + DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame, doc: /* Minibufferless frames use this frame's minibuffer. === modified file 'src/nsfns.m' --- src/nsfns.m 2010-06-02 04:29:53 +0000 +++ src/nsfns.m 2010-06-27 00:30:52 +0000 @@ -1234,10 +1234,18 @@ init_frame_faces (f); - x_default_parameter (f, parms, Qmenu_bar_lines, make_number (0), "menuBar", - "menuBar", RES_TYPE_NUMBER); - x_default_parameter (f, parms, Qtool_bar_lines, make_number (0), "toolBar", - "toolBar", RES_TYPE_NUMBER); + /* The X resources controlling the menu-bar and tool-bar are + processed specially at startup, and reflected in the mode + variables; ignore them here. */ + x_default_parameter (f, parms, Qmenu_bar_lines, + NILP (Vmenu_bar_mode) + ? make_number (0) : make_number (1), + NULL, NULL, RES_TYPE_NUMBER); + x_default_parameter (f, parms, Qtool_bar_lines, + NILP (Vtool_bar_mode) + ? make_number (0) : make_number (1), + NULL, NULL, RES_TYPE_NUMBER); + x_default_parameter (f, parms, Qbuffer_predicate, Qnil, "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL); x_default_parameter (f, parms, Qtitle, Qnil, "title", "Title", === modified file 'src/w32fns.c' --- src/w32fns.c 2010-05-11 21:02:32 +0000 +++ src/w32fns.c 2010-06-27 00:30:52 +0000 @@ -290,6 +290,7 @@ /* The below are defined in frame.c. */ +extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode; extern Lisp_Object Vwindow_system_version; #ifdef GLYPH_DEBUG @@ -4462,10 +4463,17 @@ happen. */ init_frame_faces (f); - x_default_parameter (f, parameters, Qmenu_bar_lines, make_number (1), - "menuBar", "MenuBar", RES_TYPE_NUMBER); - x_default_parameter (f, parameters, Qtool_bar_lines, make_number (1), - "toolBar", "ToolBar", RES_TYPE_NUMBER); + /* The X resources controlling the menu-bar and tool-bar are + processed specially at startup, and reflected in the mode + variables; ignore them here. */ + x_default_parameter (f, parameters, Qmenu_bar_lines, + NILP (Vmenu_bar_mode) + ? make_number (0) : make_number (1), + NULL, NULL, RES_TYPE_NUMBER); + x_default_parameter (f, parameters, Qtool_bar_lines, + NILP (Vtool_bar_mode) + ? make_number (0) : make_number (1), + NULL, NULL, RES_TYPE_NUMBER); x_default_parameter (f, parameters, Qbuffer_predicate, Qnil, "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL); === modified file 'src/xfns.c' --- src/xfns.c 2010-06-22 07:55:08 +0000 +++ src/xfns.c 2010-06-27 00:30:52 +0000 @@ -204,6 +204,8 @@ /* The below are defined in frame.c. */ +extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode; + #if GLYPH_DEBUG int image_cache_refcount, dpyinfo_refcount; #endif @@ -3450,10 +3452,18 @@ happen. */ init_frame_faces (f); - x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1), - "menuBar", "MenuBar", RES_TYPE_BOOLEAN_NUMBER); - x_default_parameter (f, parms, Qtool_bar_lines, make_number (1), - "toolBar", "ToolBar", RES_TYPE_NUMBER); + /* The X resources controlling the menu-bar and tool-bar are + processed specially at startup, and reflected in the mode + variables; ignore them here. */ + x_default_parameter (f, parms, Qmenu_bar_lines, + NILP (Vmenu_bar_mode) + ? make_number (0) : make_number (1), + NULL, NULL, RES_TYPE_NUMBER); + x_default_parameter (f, parms, Qtool_bar_lines, + NILP (Vtool_bar_mode) + ? make_number (0) : make_number (1), + NULL, NULL, RES_TYPE_NUMBER); + x_default_parameter (f, parms, Qbuffer_predicate, Qnil, "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL); ------------------------------------------------------------ Use --include-merges or -n0 to see merged revisions.