------------------------------------------------------------ revno: 114733 committer: Dmitry Gutov branch nick: trunk timestamp: Mon 2013-10-21 10:15:47 +0400 message: * indent/ruby.rb: Fix a typo diff: === modified file 'test/indent/ruby.rb' --- test/indent/ruby.rb 2013-10-21 05:54:18 +0000 +++ test/indent/ruby.rb 2013-10-21 06:15:47 +0000 @@ -182,7 +182,7 @@ tee } -if foo + +if foo && bar end ------------------------------------------------------------ revno: 114732 committer: Dmitry Gutov branch nick: trunk timestamp: Mon 2013-10-21 09:54:18 +0400 message: * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Add (almost) all infix operators. (ruby-smie--implicit-semi-p): Add new operator chars. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-21 03:50:06 +0000 +++ lisp/ChangeLog 2013-10-21 05:54:18 +0000 @@ -1,5 +1,8 @@ 2013-10-21 Dmitry Gutov + * progmodes/ruby-mode.el (ruby-smie-grammar): Add (almost) all infix operators. + (ruby-smie--implicit-semi-p): Add new operator chars. + * progmodes/ruby-mode.el (ruby-mode-map): Add binding for `smie-down-list'. (ruby-smie--args-separator-p): Check that there's no newline === modified file 'lisp/progmodes/ruby-mode.el' --- lisp/progmodes/ruby-mode.el 2013-10-21 03:50:06 +0000 +++ lisp/progmodes/ruby-mode.el 2013-10-21 05:54:18 +0000 @@ -248,48 +248,67 @@ (require 'smie) +;; Here's a simplified BNF grammar, for reference: +;; http://www.cse.buffalo.edu/~regan/cse305/RubyBNF.pdf (defconst ruby-smie-grammar ;; FIXME: Add support for Cucumber. (smie-prec2->grammar - (smie-bnf->prec2 - '((id) - (insts (inst) (insts ";" insts)) - (inst (exp) (inst "iuwu-mod" exp)) - (exp (exp1) (exp "," exp) (exp "=" exp) (exp "-" exp) (exp "+" exp) - (id " @ " exp)) - (exp1 (exp2) (exp2 "?" exp1 ":" exp1)) - (exp2 ("def" insts "end") - ("begin" insts-rescue-insts "end") - ("do" insts "end") - ("class" insts "end") ("module" insts "end") - ("for" for-body "end") - ("[" expseq "]") - ("{" hashvals "}") - ("{" insts "}") - ("while" insts "end") - ("until" insts "end") - ("unless" insts "end") - ("if" if-body "end") - ("case" cases "end")) - (formal-params ("opening-|" exp "|")) - (for-body (for-head ";" insts)) - (for-head (id "in" exp)) - (cases (exp "then" insts) ;; FIXME: Ruby also allows (exp ":" insts). - (cases "when" cases) (insts "else" insts)) - (expseq (exp) );;(expseq "," expseq) - (hashvals (id "=>" exp1) (hashvals "," hashvals)) - (insts-rescue-insts (insts) - (insts-rescue-insts "rescue" insts-rescue-insts) - (insts-rescue-insts "ensure" insts-rescue-insts)) - (itheni (insts) (exp "then" insts)) - (ielsei (itheni) (itheni "else" insts)) - (if-body (ielsei) (if-body "elsif" if-body))) - '((nonassoc "in") (assoc ";") (right " @ ") - (assoc ",") (right "=") (assoc "-" "+")) - '((assoc "when")) - '((assoc "elsif")) - '((assoc "rescue" "ensure")) - '((assoc ","))))) + (smie-merge-prec2s + (smie-bnf->prec2 + '((id) + (insts (inst) (insts ";" insts)) + (inst (exp) (inst "iuwu-mod" exp)) + (exp (exp1) (exp "," exp) (exp "=" exp) + (id " @ " exp)) + (exp1 (exp2) (exp2 "?" exp1 ":" exp1)) + (exp2 ("def" insts "end") + ("begin" insts-rescue-insts "end") + ("do" insts "end") + ("class" insts "end") ("module" insts "end") + ("for" for-body "end") + ("[" expseq "]") + ("{" hashvals "}") + ("{" insts "}") + ("while" insts "end") + ("until" insts "end") + ("unless" insts "end") + ("if" if-body "end") + ("case" cases "end")) + (formal-params ("opening-|" exp "|")) + (for-body (for-head ";" insts)) + (for-head (id "in" exp)) + (cases (exp "then" insts) ;; FIXME: Ruby also allows (exp ":" insts). + (cases "when" cases) (insts "else" insts)) + (expseq (exp) );;(expseq "," expseq) + (hashvals (id "=>" exp1) (hashvals "," hashvals)) + (insts-rescue-insts (insts) + (insts-rescue-insts "rescue" insts-rescue-insts) + (insts-rescue-insts "ensure" insts-rescue-insts)) + (itheni (insts) (exp "then" insts)) + (ielsei (itheni) (itheni "else" insts)) + (if-body (ielsei) (if-body "elsif" if-body))) + '((nonassoc "in") (assoc ";") (right " @ ") + (assoc ",") (right "=")) + '((assoc "when")) + '((assoc "elsif")) + '((assoc "rescue" "ensure")) + '((assoc ","))) + + (smie-precs->prec2 + '((right "=") + (right "+=" "-=" "*=" "/=" "%=" "**=" "&=" "|=" "^=" + "<<=" ">>=" "&&=" "||=") + (left ".." "...") + (left "+" "-") + (left "*" "/" "%" "**") + ;; (left "|") ; FIXME: Conflicts with | after block parameters. + (left "^" "&") + (nonassoc "<=>") + (nonassoc ">" ">=" "<" "<=") + (nonassoc "==" "===" "!=") + (nonassoc "=~" "!~") + (left "<<" ">>") + (left "&&" "||")))))) (defun ruby-smie--bosp () (save-excursion (skip-chars-backward " \t") @@ -300,7 +319,7 @@ (skip-chars-backward " \t") (not (or (bolp) (and (memq (char-before) - '(?\; ?- ?+ ?* ?/ ?: ?. ?, ?\[ ?\( ?\{ ?\\)) + '(?\; ?- ?+ ?* ?/ ?: ?. ?, ?\[ ?\( ?\{ ?\\ ?& ?> ?< ?% ?~)) ;; Make sure it's not the end of a regexp. (not (eq (car (syntax-after (1- (point)))) 7))) (and (eq (char-before) ?\?) === modified file 'test/indent/ruby.rb' --- test/indent/ruby.rb 2013-10-21 03:50:06 +0000 +++ test/indent/ruby.rb 2013-10-21 05:54:18 +0000 @@ -182,6 +182,10 @@ tee } +if foo + + bar +end + # Examples below still fail with `ruby-use-smie' on: foo + @@ -194,10 +198,6 @@ foo_bar_tee(1, 2, 3) .qux -if foo && - bar -end - method !arg1, arg2 ------------------------------------------------------------ revno: 114731 committer: Dmitry Gutov branch nick: trunk timestamp: Mon 2013-10-21 07:50:06 +0400 message: * lisp/progmodes/ruby-mode.el (ruby-mode-map): Add binding for `smie-down-list'. (ruby-smie--args-separator-p): Check that there's no newline between method call and its arguments. (ruby-smie-rules): Handle new cases: curly block with and without parameters, hash surrounded with parens, block passed to paren-less method call. * test/indent/ruby.rb: New examples for indentation of blocks. Example of hash inside parens that inflooped before this commit. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-20 14:27:22 +0000 +++ lisp/ChangeLog 2013-10-21 03:50:06 +0000 @@ -1,3 +1,10 @@ +2013-10-21 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-mode-map): Add binding for + `smie-down-list'. + (ruby-smie--args-separator-p): Check that there's no newline + between method call and its arguments. + 2013-10-20 Alan Mackenzie Allow comma separated lists after Java "implements". === modified file 'lisp/progmodes/ruby-mode.el' --- lisp/progmodes/ruby-mode.el 2013-10-14 01:51:20 +0000 +++ lisp/progmodes/ruby-mode.el 2013-10-21 03:50:06 +0000 @@ -152,6 +152,8 @@ (define-key map (kbd "M-C-b") 'ruby-backward-sexp) (define-key map (kbd "M-C-f") 'ruby-forward-sexp) (define-key map (kbd "M-C-q") 'ruby-indent-exp)) + (when ruby-use-smie + (define-key map (kbd "M-C-d") 'smie-down-list)) (define-key map (kbd "M-C-p") 'ruby-beginning-of-block) (define-key map (kbd "M-C-n") 'ruby-end-of-block) (define-key map (kbd "C-c {") 'ruby-toggle-block) @@ -327,10 +329,10 @@ (defun ruby-smie--args-separator-p (pos) (and + (< pos (line-end-position)) (or (eq (char-syntax (preceding-char)) '?w) (and (memq (preceding-char) '(?! ??)) (eq (char-syntax (char-before (1- (point)))) '?w))) - (< pos (point-max)) (memq (char-syntax (char-after pos)) '(?w ?\")))) (defun ruby-smie--forward-id () @@ -440,20 +442,39 @@ (`(:elem . args) (if (looking-at "\\s\"") 0)) ;; (`(:after . ",") (smie-rule-separator kind)) (`(:after . ";") - (if (smie-rule-parent-p "def" "begin" "do" "class" "module" "for" - "while" "until" "unless" - "if" "then" "elsif" "else" "when" - "rescue" "ensure") - (smie-rule-parent ruby-indent-level) - ;; For (invalid) code between switch and case. - ;; (if (smie-parent-p "switch") 4) - 0)) + (cond + ((smie-rule-parent-p "def" "begin" "do" "class" "module" "for" + "while" "until" "unless" + "if" "then" "elsif" "else" "when" + "rescue" "ensure") + (smie-rule-parent ruby-indent-level)) + ((and (smie-rule-parent-p "{") + (save-excursion + (goto-char (1+ (cadr (smie-indent--parent)))) + (ruby-smie--opening-pipe-p) + (forward-char -1) + ;; Can't delegate to `smie-rule-parent' because it + ;; short-circuits to `current-column' when the parent + ;; token is of paren syntax class and not hanging. + (cons 'column (+ (smie-indent-virtual) + ruby-indent-level))))) + ;; For (invalid) code between switch and case. + ;; (if (smie-parent-p "switch") 4) + (t 0))) (`(:before . ,(or `"(" `"[" `"{")) - ;; Treat purely syntactic block-constructs as being part of their parent, - ;; when the opening statement is hanging. - (when (smie-rule-hanging-p) - (smie-backward-sexp 'halfsexp) (smie-indent-virtual))) + (cond + ((and (equal token "{") + (not (smie-rule-prev-p "(" "{" "[" "," "=>"))) + ;; Curly block opener. + (smie-rule-parent)) + ((smie-rule-hanging-p) + ;; Treat purely syntactic block-constructs as being part of their parent, + ;; when the opening statement is hanging. + (let ((state (smie-backward-sexp 'halfsexp))) + (when (eq t (car state)) (goto-char (cadr state)))) + (cons 'column (smie-indent-virtual))))) (`(:after . ,(or "=" "iuwu-mod")) 2) + (`(:after . " @ ") (smie-rule-parent)) (`(:before . "do") (smie-rule-parent)) (`(:before . ,(or `"else" `"then" `"elsif" `"rescue" `"ensure")) 0) (`(:before . ,(or `"when")) === modified file 'test/ChangeLog' --- test/ChangeLog 2013-10-18 04:27:34 +0000 +++ test/ChangeLog 2013-10-21 03:50:06 +0000 @@ -1,3 +1,8 @@ +2013-10-21 Dmitry Gutov + + * indent/ruby.rb: New examples for indentation of blocks. Example + of hash inside parens that inflooped before the present commit. + 2013-10-17 Barry O'Reilly * test/automated/timer-tests.el: New file. Tests that (sit-for 0) === modified file 'test/indent/ruby.rb' --- test/indent/ruby.rb 2013-10-15 01:21:22 +0000 +++ test/indent/ruby.rb 2013-10-21 03:50:06 +0000 @@ -40,6 +40,11 @@ a: b } +foo({ + a: b, + c: d + }) + foo = [ # ruby-deep-indent-disabled 1 ] @@ -165,6 +170,18 @@ method! arg1, arg2 +it "is a method call with block" do |asd| + foo +end + +it("is too!") { + bar +} + +and_this_one(has) { |block, parameters| + tee +} + # Examples below still fail with `ruby-use-smie' on: foo + @@ -192,11 +209,3 @@ method (a + b), c - -it "is a method call with block" do - foo -end - -it("is too!") { - bar -} ------------------------------------------------------------ revno: 114730 fixes bug: http://debbugs.gnu.org/15607 committer: Jan D. branch nick: trunk timestamp: Sun 2013-10-20 18:47:42 +0200 message: * emacs.c (main): On Cocoa, if GUI session and 0 is not a tty, chdir to HOME. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-20 09:55:25 +0000 +++ src/ChangeLog 2013-10-20 16:47:42 +0000 @@ -1,5 +1,8 @@ 2013-10-20 Jan Djärv + * emacs.c (main): On Cocoa, if GUI session and 0 is not a tty, + chdir to HOME (bug#15607). + * nsterm.m (Qcocoa, Qgnustep): New variables. (syms_of_nsterm): Defsym Qcocoa, Qgnustep. Fprovide appropriate one. (ns_get_color): Make selection color work for GNUStep also. === modified file 'src/emacs.c' --- src/emacs.c 2013-10-17 03:08:59 +0000 +++ src/emacs.c 2013-10-20 16:47:42 +0000 @@ -1187,10 +1187,13 @@ if (!noninteractive) { #ifdef NS_IMPL_COCOA - if (skip_args < argc) + /* Started from GUI? */ + /* FIXME: Do the right thing if getenv returns NULL, or if + chdir fails. */ + if (! inhibit_window_system && ! isatty (0)) + chdir (getenv ("HOME")); + else if (skip_args < argc) { - /* FIXME: Do the right thing if getenv returns NULL, or if - chdir fails. */ if (!strncmp (argv[skip_args], "-psn", 4)) { skip_args += 1; ------------------------------------------------------------ revno: 114729 committer: Alan Mackenzie branch nick: trunk timestamp: Sun 2013-10-20 14:27:22 +0000 message: Allow comma separated lists after Java "implements". * progmodes/cc-engine.el (c-backward-over-enum-header): parse commas. * progmodes/cc-fonts.el (c-basic-matchers-after): Remove comma from a "disallowed" list in enum fontification. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-20 11:28:58 +0000 +++ lisp/ChangeLog 2013-10-20 14:27:22 +0000 @@ -1,3 +1,12 @@ +2013-10-20 Alan Mackenzie + + Allow comma separated lists after Java "implements". + + * progmodes/cc-engine.el (c-backward-over-enum-header): parse + commas. + * progmodes/cc-fonts.el (c-basic-matchers-after): Remove comma + from a "disallowed" list in enum fontification. + 2013-10-20 Johan Bockgård * startup.el (default-frame-background-mode): Remove unused === modified file 'lisp/progmodes/cc-engine.el' --- lisp/progmodes/cc-engine.el 2013-10-19 15:11:07 +0000 +++ lisp/progmodes/cc-engine.el 2013-10-20 14:27:22 +0000 @@ -8492,10 +8492,12 @@ (or (not (looking-at "\\s)")) (c-go-up-list-backward)) (cond - ((and (looking-at c-symbol-key) (c-on-identifier)) + ((and (looking-at c-symbol-key) (c-on-identifier) + (not before-identifier)) (setq before-identifier t)) ((and before-identifier - (looking-at c-postfix-decl-spec-key)) + (or (eq (char-after) ?,) + (looking-at c-postfix-decl-spec-key))) (setq before-identifier nil) t) ((looking-at c-brace-list-key) nil) === modified file 'lisp/progmodes/cc-fonts.el' --- lisp/progmodes/cc-fonts.el 2013-10-13 19:54:46 +0000 +++ lisp/progmodes/cc-fonts.el 2013-10-20 14:27:22 +0000 @@ -1884,7 +1884,7 @@ "\\)\\>" ;; Disallow various common punctuation chars that can't come ;; before the '{' of the enum list, to avoid searching too far. - "[^\]\[{}();,/#=]*" + "[^\]\[{}();/#=]*" "{") '((c-font-lock-declarators limit t nil) (save-match-data ------------------------------------------------------------ revno: 114728 committer: Johan Bockgård branch nick: trunk timestamp: Sun 2013-10-20 13:28:58 +0200 message: * lisp/startup.el (default-frame-background-mode): Remove unused defvar. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-20 10:13:26 +0000 +++ lisp/ChangeLog 2013-10-20 11:28:58 +0000 @@ -1,5 +1,8 @@ 2013-10-20 Johan Bockgård + * startup.el (default-frame-background-mode): Remove unused + defvar. + * progmodes/verilog-mode.el (verilog-mode): Don't set comment-indent-function globally. === modified file 'lisp/startup.el' --- lisp/startup.el 2013-09-17 07:39:54 +0000 +++ lisp/startup.el 2013-10-20 11:28:58 +0000 @@ -397,8 +397,6 @@ (defvar no-blinking-cursor nil) -(defvar default-frame-background-mode) - (defvar pure-space-overflow nil "Non-nil if building Emacs overflowed pure space.") ------------------------------------------------------------ revno: 114727 committer: Johan Bockgård branch nick: trunk timestamp: Sun 2013-10-20 12:13:26 +0200 message: * lisp/progmodes/verilog-mode.el (verilog-mode): Don't set comment-indent-function globally. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-20 09:26:15 +0000 +++ lisp/ChangeLog 2013-10-20 10:13:26 +0000 @@ -1,3 +1,8 @@ +2013-10-20 Johan Bockgård + + * progmodes/verilog-mode.el (verilog-mode): Don't set + comment-indent-function globally. + 2013-10-20 Jan Djärv * menu-bar.el: Put help-menu in menu-bar-final-items unconditionally. === modified file 'lisp/progmodes/verilog-mode.el' --- lisp/progmodes/verilog-mode.el 2013-10-18 07:56:45 +0000 +++ lisp/progmodes/verilog-mode.el 2013-10-20 10:13:26 +0000 @@ -3657,7 +3657,7 @@ (set-syntax-table verilog-mode-syntax-table) (set (make-local-variable 'indent-line-function) #'verilog-indent-line-relative) - (setq comment-indent-function 'verilog-comment-indent) + (set (make-local-variable 'comment-indent-function) 'verilog-comment-indent) (set (make-local-variable 'parse-sexp-ignore-comments) nil) (set (make-local-variable 'comment-start) "// ") (set (make-local-variable 'comment-end) "") ------------------------------------------------------------ revno: 114726 committer: Jan D. branch nick: trunk timestamp: Sun 2013-10-20 11:55:25 +0200 message: * src/nsterm.m (ns_get_color): Make selection color work for GNUStep also. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-20 08:50:34 +0000 +++ src/ChangeLog 2013-10-20 09:55:25 +0000 @@ -2,6 +2,7 @@ * nsterm.m (Qcocoa, Qgnustep): New variables. (syms_of_nsterm): Defsym Qcocoa, Qgnustep. Fprovide appropriate one. + (ns_get_color): Make selection color work for GNUStep also. 2013-10-18 Eli Zaretskii === modified file 'src/nsterm.m' --- src/nsterm.m 2013-10-20 08:50:34 +0000 +++ src/nsterm.m 2013-10-20 09:55:25 +0000 @@ -1461,15 +1461,16 @@ /*fprintf (stderr, "ns_get_color: '%s'\n", name); */ block_input (); -#ifdef NS_IMPL_COCOA if ([nsname isEqualToString: @"ns_selection_bg_color"]) { +#ifdef NS_IMPL_COCOA NSString *defname = [[NSUserDefaults standardUserDefaults] stringForKey: @"AppleHighlightColor"]; - if (defname != nil) nsname = defname; - else if ((new = [NSColor selectedTextBackgroundColor]) != nil) + else +#endif + if ((new = [NSColor selectedTextBackgroundColor]) != nil) { *col = [new colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; unblock_input (); @@ -1495,7 +1496,6 @@ nsname = NS_SELECTION_FG_COLOR_DEFAULT; name = [nsname UTF8String]; } -#endif // NS_IMPL_COCOA /* First, check for some sort of numeric specification. */ hex[0] = '\0'; ------------------------------------------------------------ revno: 114725 committer: Johan Bockgård branch nick: trunk timestamp: Sun 2013-10-20 11:51:21 +0200 message: * lisp/cedet/semantic/db-mode.el (global-semanticdb-minor-mode): Remove hooks correctly. (semanticdb-toggle-global-mode): Pass `toggle' to minor mode function. diff: === modified file 'lisp/cedet/ChangeLog' --- lisp/cedet/ChangeLog 2013-09-28 02:54:27 +0000 +++ lisp/cedet/ChangeLog 2013-10-20 09:51:21 +0000 @@ -1,3 +1,10 @@ +2013-10-20 Johan Bockgård + + * semantic/db-mode.el (global-semanticdb-minor-mode): Remove hooks + correctly. + (semanticdb-toggle-global-mode): Pass `toggle' to minor mode + function. + 2013-09-28 Leo Liu * semantic/texi.el (semantic-analyze-possible-completions): Use === modified file 'lisp/cedet/semantic/db-mode.el' --- lisp/cedet/semantic/db-mode.el 2013-01-01 09:11:05 +0000 +++ lisp/cedet/semantic/db-mode.el 2013-10-20 09:51:21 +0000 @@ -66,7 +66,7 @@ (add-hook (cadr elt) (car elt))) ;; Disable (dolist (elt semanticdb-hooks) - (add-hook (cadr elt) (car elt))))) + (remove-hook (cadr elt) (car elt))))) (defvaralias 'semanticdb-mode-hook 'global-semanticdb-minor-mode-hook) (defvaralias 'semanticdb-global-mode 'global-semanticdb-minor-mode) @@ -82,7 +82,7 @@ ;; Save databases before disabling semanticdb. (semanticdb-save-all-db)) ;; Toggle semanticdb minor mode. - (global-semanticdb-minor-mode)) + (global-semanticdb-minor-mode 'toggle)) ;;; Hook Functions: ;; ------------------------------------------------------------ revno: 114724 committer: Jan D. branch nick: trunk timestamp: Sun 2013-10-20 11:26:15 +0200 message: Make Info menu for GNUStep only for GUI. * menu-bar.el: Put help-menu in menu-bar-final-items unconditionally. Move Info menu item creation to ns-win.el. * term/ns-win.el (ns-initialize-window-system): Rename Help to Info in menu bar. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-20 08:50:34 +0000 +++ lisp/ChangeLog 2013-10-20 09:26:15 +0000 @@ -1,5 +1,11 @@ 2013-10-20 Jan Djärv + * menu-bar.el: Put help-menu in menu-bar-final-items unconditionally. + Move Info menu item creation to ns-win.el. + + * term/ns-win.el (ns-initialize-window-system): Rename Help to Info + in menu bar. + * menu-bar.el: Move GNUStep specific menus... * term/ns-win.el (ns-initialize-window-system): ... to here. === modified file 'lisp/menu-bar.el' --- lisp/menu-bar.el 2013-10-20 08:50:34 +0000 +++ lisp/menu-bar.el 2013-10-20 09:26:15 +0000 @@ -40,11 +40,10 @@ (or (lookup-key global-map [menu-bar]) (define-key global-map [menu-bar] (make-sparse-keymap "menu-bar"))) -(if (not (featurep 'ns)) - ;; Force Help item to come last, after the major mode's own items. - ;; The symbol used to be called `help', but that gets confused with the - ;; help key. - (setq menu-bar-final-items '(help-menu))) +;; Force Help item to come last, after the major mode's own items. +;; The symbol used to be called `help', but that gets confused with the +;; help key. +(setq menu-bar-final-items '(help-menu)) ;; This definition is just to show what this looks like. ;; It gets modified in place when menu-bar-update-buffers is called. @@ -1731,15 +1730,8 @@ (cons "Edit" menu-bar-edit-menu)) (bindings--define-key global-map [menu-bar file] (cons "File" menu-bar-file-menu)) - -;; Put "Help" menu at the end, or Info at the front. -;; If running under GNUstep, "Help" is moved and renamed "Info" (see below). -(if (and (featurep 'ns) - (not (eq system-type 'darwin))) - (bindings--define-key global-map [menu-bar help-menu] - (cons "Info" menu-bar-help-menu)) - (define-key-after global-map [menu-bar help-menu] - (cons (purecopy "Help") menu-bar-help-menu))) +(bindings--define-key global-map [menu-bar help-menu] + (cons (purecopy "Help") menu-bar-help-menu)) (defun menu-bar-menu-frame-live-and-visible-p () "Return non-nil if the menu frame is alive and visible. === modified file 'lisp/term/ns-win.el' --- lisp/term/ns-win.el 2013-10-20 08:50:34 +0000 +++ lisp/term/ns-win.el 2013-10-20 09:26:15 +0000 @@ -899,10 +899,15 @@ (x-open-connection (system-name) nil t) - ;; Add GNUStep menu items Services, Hide and Quit. + ;; Add GNUStep menu items Services, Hide and Quit. Rename Help to Info + ;; and put it first (i.e. omit from menu-bar-final-items. (if (featurep 'gnustep) (progn (setq menu-bar-final-items '(buffer services hide-app quit)) + + ;; If running under GNUstep, "Help" is moved and renamed "Info". + (bindings--define-key global-map [menu-bar help-menu] + (cons "Info" menu-bar-help-menu)) (bindings--define-key global-map [menu-bar quit] '(menu-item "Quit" save-buffers-kill-emacs :help "Save unsaved buffers, then exit")) ------------------------------------------------------------ revno: 114723 committer: Jan D. branch nick: trunk timestamp: Sun 2013-10-20 10:50:34 +0200 message: Fix GNUStep specific menu items. * lisp/menu-bar.el: Move GNUStep specific menus... * lisp/term/ns-win.el (ns-initialize-window-system): ... to here. * src/nsterm.m (Qcocoa, Qgnustep): New variables. (syms_of_nsterm): Defsym Qcocoa, Qgnustep. Fprovide appropriate one. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-19 22:17:56 +0000 +++ lisp/ChangeLog 2013-10-20 08:50:34 +0000 @@ -1,3 +1,9 @@ +2013-10-20 Jan Djärv + + * menu-bar.el: Move GNUStep specific menus... + + * term/ns-win.el (ns-initialize-window-system): ... to here. + 2013-10-19 Stefan Monnier * simple.el (newline): Only run post-self-insert-hook when === modified file 'lisp/menu-bar.el' --- lisp/menu-bar.el 2013-10-19 08:35:51 +0000 +++ lisp/menu-bar.el 2013-10-20 08:50:34 +0000 @@ -44,17 +44,7 @@ ;; Force Help item to come last, after the major mode's own items. ;; The symbol used to be called `help', but that gets confused with the ;; help key. - (setq menu-bar-final-items '(help-menu)) - (if (eq system-type 'darwin) - (setq menu-bar-final-items '(buffer services help-menu)) - (setq menu-bar-final-items '(buffer services hide-app quit)) - ;; Add standard top-level items to GNUstep menu. - (bindings--define-key global-map [menu-bar quit] - '(menu-item "Quit" save-buffers-kill-emacs - :help "Save unsaved buffers, then exit")) - (bindings--define-key global-map [menu-bar hide-app] - '(menu-item "Hide" ns-do-hide-emacs - :help "Hide Emacs")))) + (setq menu-bar-final-items '(help-menu))) ;; This definition is just to show what this looks like. ;; It gets modified in place when menu-bar-update-buffers is called. === modified file 'lisp/term/ns-win.el' --- lisp/term/ns-win.el 2013-10-01 18:22:48 +0000 +++ lisp/term/ns-win.el 2013-10-20 08:50:34 +0000 @@ -899,6 +899,20 @@ (x-open-connection (system-name) nil t) + ;; Add GNUStep menu items Services, Hide and Quit. + (if (featurep 'gnustep) + (progn + (setq menu-bar-final-items '(buffer services hide-app quit)) + (bindings--define-key global-map [menu-bar quit] + '(menu-item "Quit" save-buffers-kill-emacs + :help "Save unsaved buffers, then exit")) + (bindings--define-key global-map [menu-bar hide-app] + '(menu-item "Hide" ns-do-hide-emacs + :help "Hide Emacs")) + (bindings--define-key global-map [menu-bar services] + (cons "Services" (make-sparse-keymap "Services"))))) + + (dolist (service (ns-list-services)) (if (eq (car service) 'undefined) (ns-define-service (cdr service)) === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-18 13:33:25 +0000 +++ src/ChangeLog 2013-10-20 08:50:34 +0000 @@ -1,3 +1,8 @@ +2013-10-20 Jan Djärv + + * nsterm.m (Qcocoa, Qgnustep): New variables. + (syms_of_nsterm): Defsym Qcocoa, Qgnustep. Fprovide appropriate one. + 2013-10-18 Eli Zaretskii * keyboard.c (make_lispy_event): Remove GPM-specific code that === modified file 'src/nsterm.m' --- src/nsterm.m 2013-10-18 12:57:44 +0000 +++ src/nsterm.m 2013-10-20 08:50:34 +0000 @@ -173,6 +173,7 @@ extern Lisp_Object Qcursor_color, Qcursor_type, Qns, Qleft; static Lisp_Object QUTF8_STRING; +static Lisp_Object Qcocoa, Qgnustep; /* On OS X picks up the default NSGlobalDomain AppleAntiAliasingThreshold, the maximum font size to NOT antialias. On GNUstep there is currently @@ -7501,11 +7502,17 @@ /* Tell Emacs about this window system. */ Fprovide (Qns, Qnil); + DEFSYM (Qcocoa, "cocoa"); + DEFSYM (Qgnustep, "gnustep"); + syms_of_nsfont (); #ifdef NS_IMPL_COCOA + Fprovide (Qcocoa, Qnil); #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 syms_of_macfont (); #endif +#else + Fprovide (Qgnustep, Qnil); #endif } ------------------------------------------------------------ revno: 114722 committer: Stefan Monnier branch nick: trunk timestamp: Sat 2013-10-19 18:17:56 -0400 message: * lisp/simple.el (newline): Only run post-self-insert-hook when called interactively. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-19 15:22:57 +0000 +++ lisp/ChangeLog 2013-10-19 22:17:56 +0000 @@ -1,3 +1,8 @@ +2013-10-19 Stefan Monnier + + * simple.el (newline): Only run post-self-insert-hook when + called interactively. + 2013-10-19 Johan Bockgård * icomplete.el (icomplete-with-completion-tables): Add :version. === modified file 'lisp/simple.el' --- lisp/simple.el 2013-09-19 20:31:26 +0000 +++ lisp/simple.el 2013-10-19 22:17:56 +0000 @@ -377,14 +377,15 @@ (defvar hard-newline (propertize "\n" 'hard t 'rear-nonsticky '(hard)) "Propertized string representing a hard newline character.") -(defun newline (&optional arg) +(defun newline (&optional arg interactive) "Insert a newline, and move to left margin of the new line if it's blank. If option `use-hard-newlines' is non-nil, the newline is marked with the text-property `hard'. With ARG, insert that many newlines. Call `auto-fill-function' if the current column number is greater -than the value of `fill-column' and ARG is nil." - (interactive "*P") +than the value of `fill-column' and ARG is nil. +A non-nil INTERACTIVE argument means to run the `post-self-insert-hook'." + (interactive "*P\np") (barf-if-buffer-read-only) ;; Call self-insert so that auto-fill, abbrev expansion etc. happens. ;; Set last-command-event to tell self-insert what to insert. @@ -415,14 +416,20 @@ ;; starts a page. (or was-page-start (move-to-left-margin nil t))))) - (unwind-protect - (progn - (add-hook 'post-self-insert-hook postproc) + (if (not interactive) + ;; FIXME: For non-interactive uses, many calls actually just want + ;; (insert "\n"), so maybe we should do just that, so as to avoid + ;; the risk of filling or running abbrevs unexpectedly. + (let ((post-self-insert-hook (list postproc))) (self-insert-command (prefix-numeric-value arg))) - ;; We first used let-binding to protect the hook, but that was naive - ;; since add-hook affects the symbol-default value of the variable, - ;; whereas the let-binding might only protect the buffer-local value. - (remove-hook 'post-self-insert-hook postproc))) + (unwind-protect + (progn + (add-hook 'post-self-insert-hook postproc) + (self-insert-command (prefix-numeric-value arg))) + ;; We first used let-binding to protect the hook, but that was naive + ;; since add-hook affects the symbol-default value of the variable, + ;; whereas the let-binding might only protect the buffer-local value. + (remove-hook 'post-self-insert-hook postproc)))) nil) (defun set-hard-newline-properties (from to)