Using saved parent location: http://bzr.savannah.gnu.org/r/emacs/trunk/ Now on revision 102144. ------------------------------------------------------------ revno: 102144 committer: Glenn Morris branch nick: trunk timestamp: Thu 2010-10-28 23:51:36 -0700 message: Remove duplicate Lisp definition of temporary-file-directory, from filelock.c. * lisp/files.el (temporary-file-directory): Remove (already defined in C). * lisp/cus-start.el: Add temporary-file-directory. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-10-29 03:29:29 +0000 +++ lisp/ChangeLog 2010-10-29 06:51:36 +0000 @@ -1,5 +1,8 @@ 2010-10-29 Glenn Morris + * files.el (temporary-file-directory): Remove (already defined in C). + * cus-start.el: Add temporary-file-directory. + * abbrev.el (abbrev-mode): * composite.el (auto-composition-mode): * menu-bar.el (menu-bar-mode): === modified file 'lisp/cus-start.el' --- lisp/cus-start.el 2010-10-29 03:29:29 +0000 +++ lisp/cus-start.el 2010-10-29 06:51:36 +0000 @@ -174,6 +174,35 @@ ;; fileio.c (delete-by-moving-to-trash auto-save boolean "23.1") (auto-save-visited-file-name auto-save boolean) + ;; filelock.c + (temporary-file-directory + ;; Darwin section added 24.1, does not seem worth :version bump. + files directory nil + (file-name-as-directory + ;; FIXME ? Should there be Ftemporary_file_directory to do this + ;; more robustly (cf set_local_socket in emacsclient.c). + ;; It could be used elsewhere, eg Fcall_process_region, + ;; server-socket-dir. See bug#7135. + (cond ((memq system-type '(ms-dos windows-nt)) + (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP") + "c:/temp")) + ((eq system-type 'darwin) + (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") + ;; See bug#7135. + (let ((tmp (ignore-errors + (shell-command-to-string + "getconf DARWIN_USER_TEMP_DIR")))) + (and (stringp tmp) + (setq tmp (replace-regexp-in-string + "\n\\'" "" tmp)) + ;; Handles "getconf: Unrecognized variable..." + (file-directory-p tmp) + tmp)) + "/tmp")) + (t + (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") + "/tmp")))) + :initialize custom-initialize-delay) ;; fns.c (use-dialog-box menu boolean "21.1") (use-file-dialog menu boolean "22.1") === modified file 'lisp/files.el' --- lisp/files.el 2010-10-18 21:02:00 +0000 +++ lisp/files.el 2010-10-29 06:51:36 +0000 @@ -188,32 +188,6 @@ "Non-nil if visited file was read-only when visited.") (make-variable-buffer-local 'buffer-file-read-only) -(defcustom temporary-file-directory - (file-name-as-directory - ;; FIXME ? Should there be Ftemporary_file_directory to do the - ;; following more robustly (cf set_local_socket in emacsclient.c). - ;; It could be used elsewhere, eg Fcall_process_region, server-socket-dir. - ;; See bug#7135. - (cond ((memq system-type '(ms-dos windows-nt)) - (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP") "c:/temp")) - ((eq system-type 'darwin) - (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") - (let ((tmp (ignore-errors (shell-command-to-string ; bug#7135 - "getconf DARWIN_USER_TEMP_DIR")))) - (and (stringp tmp) - (setq tmp (replace-regexp-in-string "\n\\'" "" tmp)) - ;; This handles "getconf: Unrecognized variable..." - (file-directory-p tmp) - tmp)) - "/tmp")) - (t - (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "/tmp")))) - "The directory for writing temporary files." - :group 'files - ;; Darwin section added 24.1, does not seem worth :version bump. - :initialize 'custom-initialize-delay - :type 'directory) - (defcustom small-temporary-file-directory (if (eq system-type 'ms-dos) (getenv "TMPDIR")) "The directory for writing small temporary files. @@ -6470,5 +6444,4 @@ (define-key ctl-x-5-map "r" 'find-file-read-only-other-frame) (define-key ctl-x-5-map "\C-o" 'display-buffer-other-frame) -;; arch-tag: bc68d3ea-19ca-468b-aac6-3a4a7766101f ;;; files.el ends here ------------------------------------------------------------ revno: 102143 committer: Glenn Morris branch nick: trunk timestamp: Thu 2010-10-28 20:29:29 -0700 message: Remove duplicate Lisp definitions of define-minor-mode variables defined in C. * lisp/abbrev.el (abbrev-mode): * lisp/composite.el (auto-composition-mode): * lisp/menu-bar.el (menu-bar-mode): * lisp/simple.el (transient-mark-mode): * lisp/tool-bar.el (tool-bar-mode): Adjust the define-minor-mode calls so that they do not define the associated variables twice. * lisp/simple.el (transient-mark-mode): Remove defvar. * lisp/composite.el (auto-composition-mode): Make variable auto-buffer-local. * lisp/cus-start.el: Add transient-mark-mode, menu-bar-mode, tool-bar-mode. Handle multiple groups, and also custom-delayed-init-variables. * lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Doc fix. * src/buffer.c (syms_of_buffer) : * src/frame.c (syms_of_frame) : Move docs here from Lisp. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-10-29 01:05:38 +0000 +++ lisp/ChangeLog 2010-10-29 03:29:29 +0000 @@ -1,3 +1,17 @@ +2010-10-29 Glenn Morris + + * abbrev.el (abbrev-mode): + * composite.el (auto-composition-mode): + * menu-bar.el (menu-bar-mode): + * simple.el (transient-mark-mode): + * tool-bar.el (tool-bar-mode): Adjust the define-minor-mode calls so + that they do not define the associated variables twice. + * simple.el (transient-mark-mode): Remove defvar. + * composite.el (auto-composition-mode): Make variable auto-buffer-local. + * cus-start.el: Add transient-mark-mode, menu-bar-mode, tool-bar-mode. + Handle multiple groups, and also custom-delayed-init-variables. + * emacs-lisp/easy-mmode.el (define-minor-mode): Doc fix. + 2010-10-29 Stefan Monnier * emacs-lisp/pcase.el (pcase): New `string' and `guard' patterns. === modified file 'lisp/abbrev.el' --- lisp/abbrev.el 2010-10-27 06:50:28 +0000 +++ lisp/abbrev.el 2010-10-29 03:29:29 +0000 @@ -57,7 +57,9 @@ "Toggle Abbrev mode in the current buffer. With optional argument ARG, turn abbrev mode on if ARG is positive, otherwise turn it off. In Abbrev mode, inserting an -abbreviation causes it to expand and be replaced by its expansion.") +abbreviation causes it to expand and be replaced by its expansion." + ;; It's defined in C, this stops the d-m-m macro defining it again. + :variable abbrev-mode) (put 'abbrev-mode 'safe-local-variable 'booleanp) === modified file 'lisp/composite.el' --- lisp/composite.el 2010-10-14 14:32:27 +0000 +++ lisp/composite.el 2010-10-29 03:29:29 +0000 @@ -743,7 +743,11 @@ by functions registered in `composition-function-table' (which see). You can use `global-auto-composition-mode' to turn on -Auto Composition mode in all buffers (this is the default).") +Auto Composition mode in all buffers (this is the default)." + ;; It's defined in C, this stops the d-m-m macro defining it again. + :variable auto-composition-mode) +;; It's not defined with DEFVAR_PER_BUFFER though. +(make-variable-buffer-local 'auto-composition-mode) ;;;###autoload (define-minor-mode global-auto-composition-mode @@ -757,5 +761,4 @@ -;; arch-tag: ee703d77-1723-45d4-a31f-e9f0f867aa33 ;;; composite.el ends here === modified file 'lisp/cus-start.el' --- lisp/cus-start.el 2010-10-24 00:58:22 +0000 +++ lisp/cus-start.el 2010-10-29 03:29:29 +0000 @@ -101,6 +101,9 @@ :set #'(lambda (symbol value) (set-default symbol value) (force-mode-line-update t))) + (transient-mark-mode editing-basics boolean nil + (not noninteractive) + :initialize custom-initialize-delay) ;; callint.c (mark-even-if-inactive editing-basics boolean) ;; callproc.c @@ -185,6 +188,8 @@ (other :tag "hidden by keypress" 1)) "22.1") (make-pointer-invisible mouse boolean "23.2") + (menu-bar-mode frames boolean) + (tool-bar-mode (frames mouse) boolean) ;; fringe.c (overflow-newline-into-fringe fringe boolean) ;; indent.c @@ -452,11 +457,17 @@ (put symbol 'safe-local-variable (cadr prop))) (if (setq prop (memq :risky rest)) (put symbol 'risky-local-variable (cadr prop))) + ;; Note this is the _only_ initialize property we handle. + (if (eq (cadr (memq :initialize rest)) 'custom-initialize-delay) + (push symbol custom-delayed-init-variables)) ;; If this is NOT while dumping Emacs, ;; set up the rest of the customization info. (unless purify-flag - ;; Add it to the right group. - (custom-add-to-group group symbol 'custom-variable) + ;; Add it to the right group(s). + (if (listp group) + (dolist (g group) + (custom-add-to-group g symbol 'custom-variable)) + (custom-add-to-group group symbol 'custom-variable)) ;; Set the type. (put symbol 'custom-type type) (put symbol 'custom-version version) === modified file 'lisp/emacs-lisp/easy-mmode.el' --- lisp/emacs-lisp/easy-mmode.el 2010-08-29 16:17:13 +0000 +++ lisp/emacs-lisp/easy-mmode.el 2010-10-29 03:29:29 +0000 @@ -119,7 +119,8 @@ of the variable MODE to store the state of the mode. PLACE can also be of the form (GET . SET) where GET is an expression that returns the current state and SET is a function that takes - a new state and sets it. + a new state and sets it. If you specify a :variable, this + function assumes it is defined elsewhere. For example, you could write (define-minor-mode foo-mode \"If enabled, foo on you!\" @@ -196,6 +197,7 @@ `(:group ',(intern (replace-regexp-in-string "-mode\\'" "" mode-name))))) + ;; TODO? Mark booleans as safe if booleanp? Eg abbrev-mode. (unless type (setq type '(:type 'boolean))) `(progn @@ -583,5 +585,4 @@ (provide 'easy-mmode) -;; arch-tag: d48a5250-6961-4528-9cb0-3c9ea042a66a ;;; easy-mmode.el ends here === modified file 'lisp/menu-bar.el' --- lisp/menu-bar.el 2010-10-28 07:05:00 +0000 +++ lisp/menu-bar.el 2010-10-29 03:29:29 +0000 @@ -2073,7 +2073,8 @@ turn on menu bars; otherwise, turn off menu bars." :init-value t :global t - :group 'frames + ;; It's defined in C/cus-start, this stops the d-m-m macro defining it again. + :variable menu-bar-mode ;; Turn the menu-bars on all frames on or off. (let ((val (if menu-bar-mode 1 0))) === modified file 'lisp/simple.el' --- lisp/simple.el 2010-10-28 03:49:40 +0000 +++ lisp/simple.el 2010-10-29 03:29:29 +0000 @@ -1,8 +1,8 @@ ;;; simple.el --- basic editing commands for Emacs -;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, +;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, +;; 2010 Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: internal @@ -4051,29 +4051,8 @@ \"mark.*active\" at the prompt, to see the documentation of commands which are sensitive to the Transient Mark mode." :global t - :init-value (not noninteractive) - :initialize 'custom-initialize-delay - :group 'editing-basics) - -;; The variable transient-mark-mode is ugly: it can take on special -;; values. Document these here. -(defvar transient-mark-mode t - "*Non-nil if Transient Mark mode is enabled. -See the command `transient-mark-mode' for a description of this minor mode. - -Non-nil also enables highlighting of the region whenever the mark is active. -The variable `highlight-nonselected-windows' controls whether to highlight -all windows or just the selected window. - -If the value is `lambda', that enables Transient Mark mode temporarily. -After any subsequent action that would normally deactivate the mark -\(such as buffer modification), Transient Mark mode is turned off. - -If the value is (only . OLDVAL), that enables Transient Mark mode -temporarily. After any subsequent point motion command that is not -shift-translated, or any other action that would normally deactivate -the mark (such as buffer modification), the value of -`transient-mark-mode' is set to OLDVAL.") + ;; It's defined in C/cus-start, this stops the d-m-m macro defining it again. + :variable transient-mark-mode) (defvar widen-automatically t "Non-nil means it is ok for commands to call `widen' when they want to. === modified file 'lisp/tool-bar.el' --- lisp/tool-bar.el 2010-09-21 07:01:22 +0000 +++ lisp/tool-bar.el 2010-10-29 03:29:29 +0000 @@ -1,8 +1,8 @@ ;;; tool-bar.el --- setting up the tool bar -;; -;; Copyright (C) 2000, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. -;; + +;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, +;; 2009, 2010 Free Software Foundation, Inc. + ;; Author: Dave Love ;; Keywords: mouse frames ;; Package: emacs @@ -51,8 +51,8 @@ conveniently adding tool bar items." :init-value t :global t - :group 'mouse - :group 'frames + ;; It's defined in C/cus-start, this stops the d-m-m macro defining it again. + :variable tool-bar-mode (let ((val (if tool-bar-mode 1 0))) (dolist (frame (frame-list)) (set-frame-parameter frame 'tool-bar-lines val)) @@ -325,10 +325,10 @@ :initialize 'custom-initialize-default :set (lambda (sym val) (set-default sym val) - (modify-all-frames-parameters + (modify-all-frames-parameters (list (cons 'tool-bar-position val)))))) (provide 'tool-bar) -;; arch-tag: 15f30f0a-d0d7-4d50-bbb7-f48fd0c8582f + ;;; tool-bar.el ends here === modified file 'src/ChangeLog' --- src/ChangeLog 2010-10-26 22:23:09 +0000 +++ src/ChangeLog 2010-10-29 03:29:29 +0000 @@ -1,3 +1,8 @@ +2010-10-29 Glenn Morris + + * buffer.c (syms_of_buffer) : + * frame.c (syms_of_frame) : Move doc here from Lisp. + 2010-10-26 Juanma Barranquero * eval.c (init_eval_once): Set max_lisp_eval_depth to 600; === modified file 'src/buffer.c' --- src/buffer.c 2010-10-23 21:13:39 +0000 +++ src/buffer.c 2010-10-29 03:29:29 +0000 @@ -5600,7 +5600,8 @@ doc: /* Local (mode-specific) abbrev table of current buffer. */); DEFVAR_PER_BUFFER ("abbrev-mode", ¤t_buffer->abbrev_mode, Qnil, - doc: /* Non-nil turns on automatic expansion of abbrevs as they are inserted. */); + doc: /* Non-nil if Abbrev mode is enabled. +Use the command `abbrev-mode' to change this variable. */); DEFVAR_PER_BUFFER ("case-fold-search", ¤t_buffer->case_fold_search, Qnil, @@ -6098,11 +6099,23 @@ If the buffer has never been shown in a window, the value is nil. */); DEFVAR_LISP ("transient-mark-mode", &Vtransient_mark_mode, - doc: /* */); + doc: /* Non-nil if Transient Mark mode is enabled. +See the command `transient-mark-mode' for a description of this minor mode. + +Non-nil also enables highlighting of the region whenever the mark is active. +The variable `highlight-nonselected-windows' controls whether to highlight +all windows or just the selected window. + +If the value is `lambda', that enables Transient Mark mode temporarily. +After any subsequent action that would normally deactivate the mark +\(such as buffer modification), Transient Mark mode is turned off. + +If the value is (only . OLDVAL), that enables Transient Mark mode +temporarily. After any subsequent point motion command that is not +shift-translated, or any other action that would normally deactivate +the mark (such as buffer modification), the value of +`transient-mark-mode' is set to OLDVAL. */); Vtransient_mark_mode = Qnil; - /* The docstring is in simple.el. If we put it here, it would be - overwritten when transient-mark-mode is defined using - define-minor-mode. */ DEFVAR_LISP ("inhibit-read-only", &Vinhibit_read_only, doc: /* *Non-nil means disregard read-only status of buffers or characters. === modified file 'src/frame.c' --- src/frame.c 2010-10-24 21:36:09 +0000 +++ src/frame.c 2010-10-29 03:29:29 +0000 @@ -4571,7 +4571,11 @@ Vmenu_bar_mode = Qt; DEFVAR_LISP ("tool-bar-mode", &Vtool_bar_mode, - doc: /* Non-nil if Tool-Bar mode is enabled. */); + doc: /* Non-nil if Tool-Bar mode is enabled. +See the command `tool-bar-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `tool-bar-mode'. */); Vtool_bar_mode = Qt; DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame, ------------------------------------------------------------ revno: 102142 committer: Stefan Monnier branch nick: trunk timestamp: Thu 2010-10-28 21:05:38 -0400 message: * lisp/emacs-lisp/pcase.el (pcase): New `string' and `guard' patterns. (pcase-if): Add one minor optimization. (pcase-split-equal): Rename from pcase-split-eq. (pcase-split-member): Rename from pcase-split-memq. (pcase-u1): Add strings to the member optimization. Add `guard' variant of predicates. (pcase-q1): Add string patterns. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-10-28 14:36:59 +0000 +++ lisp/ChangeLog 2010-10-29 01:05:38 +0000 @@ -1,3 +1,13 @@ +2010-10-29 Stefan Monnier + + * emacs-lisp/pcase.el (pcase): New `string' and `guard' patterns. + (pcase-if): Add one minor optimization. + (pcase-split-equal): Rename from pcase-split-eq. + (pcase-split-member): Rename from pcase-split-memq. + (pcase-u1): Add strings to the member optimization. + Add `guard' variant of predicates. + (pcase-q1): Add string patterns. + 2010-10-28 Stefan Monnier * vc/log-edit.el (log-edit-rewrite-fixes): State its safety pred. === modified file 'lisp/emacs-lisp/pcase.el' --- lisp/emacs-lisp/pcase.el 2010-09-26 22:42:53 +0000 +++ lisp/emacs-lisp/pcase.el 2010-10-29 01:05:38 +0000 @@ -25,6 +25,16 @@ ;; ML-style pattern matching. ;; The entry points are autoloaded. +;; Todo: + +;; - provide ways to extend the set of primitives, with some kind of +;; define-pcase-matcher. We could easily make it so that (guard BOOLEXP) +;; could be defined this way, as a shorthand for (pred (lambda (_) BOOLEXP)). +;; But better would be if we could define new ways to match by having the +;; extension provide its own `pcase-split-' thingy. +;; - ideally we'd want (pcase s ((re RE1) E1) ((re RE2) E2)) to be able to +;; generate a lex-style DFA to decide whether to run E1 or E2. + ;;; Code: (eval-when-compile (require 'cl)) @@ -48,10 +58,12 @@ (and UPAT...) matches if all the patterns match. `QPAT matches if the QPattern QPAT matches. (pred PRED) matches if PRED applied to the object returns non-nil. + (guard BOOLEXP) matches if BOOLEXP evaluates to non-nil. QPatterns can take the following forms: (QPAT1 . QPAT2) matches if QPAT1 matches the car and QPAT2 the cdr. ,UPAT matches if the UPattern UPAT matches. + STRING matches if the object is `equal' to STRING. ATOM matches if the object is `eq' to ATOM. QPatterns for vectors are not implemented yet. @@ -77,6 +89,8 @@ (if (null bindings) body `(pcase ,(cadr (car bindings)) (,(caar bindings) (pcase-let* ,(cdr bindings) ,body)) + ;; FIXME: In many cases `dontcare' would be preferable, so maybe we + ;; should have `let' and `elet', like we have `case' and `ecase'. (t (error "Pattern match failure in `pcase-let'"))))) ;;;###autoload @@ -167,12 +181,19 @@ (cond ((eq else :pcase-dontcare) then) ((eq (car-safe else) 'if) - `(cond (,test ,then) - (,(nth 1 else) ,(nth 2 else)) - (t ,@(nthcdr 3 else)))) + (if (equal test (nth 1 else)) + ;; Doing a test a second time: get rid of the redundancy. + ;; FIXME: ideally, this should never happen because the pcase-split-* + ;; functions should have eliminated such things, but pcase-split-member + ;; is imprecise, so in practice it does happen occasionally. + `(if ,test ,then ,@(nthcdr 3 else)) + `(cond (,test ,then) + (,(nth 1 else) ,(nth 2 else)) + (t ,@(nthcdr 3 else))))) ((eq (car-safe else) 'cond) `(cond (,test ,then) - ,@(cdr else))) + ;; Doing a test a second time: get rid of the redundancy, as above. + ,@(remove (assoc test else) (cdr else)))) (t `(if ,test ,then ,else)))) (defun pcase-upat (qpattern) @@ -276,7 +297,7 @@ ;; A QPattern but not for a cons, can only go the `else' side. ((eq (car-safe pat) '\`) (cons :pcase-fail nil)))) -(defun pcase-split-eq (elem pat) +(defun pcase-split-equal (elem pat) (cond ;; The same match will give the same result. ((and (eq (car-safe pat) '\`) (equal (cadr pat) elem)) @@ -288,11 +309,11 @@ ) (cons :pcase-fail nil)))) -(defun pcase-split-memq (elems pat) - ;; Based on pcase-split-eq. +(defun pcase-split-member (elems pat) + ;; Based on pcase-split-equal. (cond - ;; The same match will give the same result, but we don't know how - ;; to check it. + ;; The same match (or a match of membership in a superset) will + ;; give the same result, but we don't know how to check it. ;; (??? ;; (cons :pcase-succeed nil)) ;; A match for one of the elements may succeed or fail. @@ -347,7 +368,8 @@ (if (and (eq (car alt) 'match) (eq var (cadr alt)) (let ((upat (cddr alt))) (and (eq (car-safe upat) '\`) - (or (integerp (cadr upat)) (symbolp (cadr upat)))))) + (or (integerp (cadr upat)) (symbolp (cadr upat)) + (stringp (cadr upat)))))) (push (cddr alt) simples) (push alt others)))) (cond @@ -380,17 +402,19 @@ ((memq upat '(t _)) (pcase-u1 matches code vars rest)) ((eq upat 'dontcare) :pcase-dontcare) ((functionp upat) (error "Feature removed, use (pred %s)" upat)) - ((eq (car-safe upat) 'pred) + ((memq (car-safe upat) '(guard pred)) (destructuring-bind (then-rest &rest else-rest) (pcase-split-rest sym (apply-partially 'pcase-split-pred upat) rest) - (pcase-if (if (symbolp (cadr upat)) + (pcase-if (if (and (eq (car upat) 'pred) (symbolp (cadr upat))) `(,(cadr upat) ,sym) (let* ((exp (cadr upat)) ;; `vs' is an upper bound on the vars we need. (vs (pcase-fgrep (mapcar #'car vars) exp)) - (call (if (functionp exp) - `(,exp ,sym) `(,@exp ,sym)))) + (call (cond + ((eq 'guard (car upat)) exp) + ((functionp exp) `(,exp ,sym)) + (t `(,@exp ,sym))))) (if (null vs) call ;; Let's not replace `vars' in `exp' since it's @@ -409,19 +433,22 @@ ((eq (car-safe upat) '\`) (pcase-q1 sym (cadr upat) matches code vars rest)) ((eq (car-safe upat) 'or) - (let ((all (> (length (cdr upat)) 1))) + (let ((all (> (length (cdr upat)) 1)) + (memq-fine t)) (when all (dolist (alt (cdr upat)) (unless (and (eq (car-safe alt) '\`) - (or (symbolp (cadr alt)) (integerp (cadr alt)))) + (or (symbolp (cadr alt)) (integerp (cadr alt)) + (setq memq-fine nil) + (stringp (cadr alt)))) (setq all nil)))) (if all ;; Use memq for (or `a `b `c `d) rather than a big tree. (let ((elems (mapcar 'cadr (cdr upat)))) (destructuring-bind (then-rest &rest else-rest) (pcase-split-rest - sym (apply-partially 'pcase-split-memq elems) rest) - (pcase-if `(memq ,sym ',elems) + sym (apply-partially 'pcase-split-member elems) rest) + (pcase-if `(,(if memq-fine #'memq #'member) ,sym ',elems) (pcase-u1 matches code vars then-rest) (pcase-u else-rest)))) (pcase-u1 (cons `(match ,sym ,@(cadr upat)) matches) code vars @@ -483,10 +510,10 @@ ,@matches) code vars then-rest)) (pcase-u else-rest))))) - ((or (integerp qpat) (symbolp qpat)) + ((or (integerp qpat) (symbolp qpat) (stringp qpat)) (destructuring-bind (then-rest &rest else-rest) - (pcase-split-rest sym (apply-partially 'pcase-split-eq qpat) rest) - (pcase-if `(eq ,sym ',qpat) + (pcase-split-rest sym (apply-partially 'pcase-split-equal qpat) rest) + (pcase-if `(,(if (stringp qpat) #'equal #'eq) ,sym ',qpat) (pcase-u1 matches code vars then-rest) (pcase-u else-rest)))) (t (error "Unkown QPattern %s" qpat)))) ------------------------------------------------------------ revno: 102141 author: Lars Magne Ingebrigtsen committer: Katsumi Yamaoka branch nick: trunk timestamp: Thu 2010-10-28 22:03:15 +0000 message: gnus-sum.el (gnus-summary-rescan-group): Try to restore the window config after reselecting. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2010-10-28 12:45:51 +0000 +++ lisp/gnus/ChangeLog 2010-10-28 22:03:15 +0000 @@ -1,3 +1,8 @@ +2010-10-28 Lars Magne Ingebrigtsen + + * gnus-sum.el (gnus-summary-rescan-group): Try to restore the window + config after reselecting. + 2010-10-28 Julien Danjou * shr.el (shr-put-image): Use point even if only inserting text. === modified file 'lisp/gnus/gnus-sum.el' --- lisp/gnus/gnus-sum.el 2010-10-25 05:43:08 +0000 +++ lisp/gnus/gnus-sum.el 2010-10-28 22:03:15 +0000 @@ -7033,7 +7033,11 @@ (defun gnus-summary-rescan-group (&optional all) "Exit the newsgroup, ask for new articles, and select the newsgroup." (interactive "P") - (gnus-summary-reselect-current-group all t)) + (let ((config gnus-current-window-configuration)) + (gnus-summary-reselect-current-group all t) + (gnus-configure-windows config) + (when (eq config 'article) + (gnus-summary-select-article)))) (defun gnus-summary-update-info (&optional non-destructive) (save-excursion ------------------------------------------------------------ revno: 102140 committer: Stefan Monnier branch nick: trunk timestamp: Thu 2010-10-28 10:36:59 -0400 message: * lisp/vc/log-edit.el (log-edit-rewrite-fixes): State its safety pred. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-10-28 07:05:00 +0000 +++ lisp/ChangeLog 2010-10-28 14:36:59 +0000 @@ -1,3 +1,7 @@ +2010-10-28 Stefan Monnier + + * vc/log-edit.el (log-edit-rewrite-fixes): State its safety pred. + 2010-10-28 Glenn Morris * term/ns-win.el (global-map, menu-bar-final-items, menu-bar-help-menu): === modified file 'lisp/vc/log-edit.el' --- lisp/vc/log-edit.el 2010-10-27 21:47:09 +0000 +++ lisp/vc/log-edit.el 2010-10-28 14:36:59 +0000 @@ -579,6 +579,8 @@ where REGEXP should match the expression referring to a bug number in the text, and REPLACEMENT is an expression to pass to `replace-match' to build the Fixes: header.") +(put 'log-edit-rewrite-fixes 'safe-local-variable + (lambda (v) (and (stringp (car-safe v)) (stringp (cdr v))))) (defun log-edit-insert-changelog (&optional use-first) "Insert a log message by looking at the ChangeLog. ------------------------------------------------------------ revno: 102139 author: Julien Danjou committer: Katsumi Yamaoka branch nick: trunk timestamp: Thu 2010-10-28 12:45:51 +0000 message: shr.el (shr-put-image): Use point even if only inserting text; save-excursion on alt text. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2010-10-28 10:41:27 +0000 +++ lisp/gnus/ChangeLog 2010-10-28 12:45:51 +0000 @@ -1,5 +1,9 @@ 2010-10-28 Julien Danjou + * shr.el (shr-put-image): Use point even if only inserting text. + (shr-put-image): Save excursion when inserting alt text on non-graphic + display, so the behaviour is the same when we are on a graphic display. + * nnir.el (nnir-run-swish-e): Remove hyrex support. 2010-10-28 Katsumi Yamaoka === modified file 'lisp/gnus/shr.el' --- lisp/gnus/shr.el 2010-10-26 22:08:30 +0000 +++ lisp/gnus/shr.el 2010-10-28 12:45:51 +0000 @@ -373,12 +373,14 @@ (kill-buffer (current-buffer))) (defun shr-put-image (data point alt) - (if (not (display-graphic-p)) - (insert alt) - (let ((image (ignore-errors - (shr-rescale-image data)))) - (when image - (put-image image point alt))))) + (if (display-graphic-p) + (let ((image (ignore-errors + (shr-rescale-image data)))) + (when image + (put-image image point alt))) + (save-excursion + (goto-char point) + (insert alt)))) (defun shr-rescale-image (data) (if (or (not (fboundp 'imagemagick-types)) ------------------------------------------------------------ revno: 102138 author: Julien Danjou committer: Katsumi Yamaoka branch nick: trunk timestamp: Thu 2010-10-28 10:41:27 +0000 message: nnir.el (nnir-run-swish-e): Remove hyrex support. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2010-10-28 06:37:35 +0000 +++ lisp/gnus/ChangeLog 2010-10-28 10:41:27 +0000 @@ -1,3 +1,7 @@ +2010-10-28 Julien Danjou + + * nnir.el (nnir-run-swish-e): Remove hyrex support. + 2010-10-28 Katsumi Yamaoka * gnus-art.el (gnus-article-jump-to-part): Error on no part; fix prompt. === modified file 'lisp/gnus/nnir.el' --- lisp/gnus/nnir.el 2010-10-24 09:55:56 +0000 +++ lisp/gnus/nnir.el 2010-10-28 10:41:27 +0000 @@ -78,9 +78,8 @@ ;; Restrictions: ;; -;; * If you don't use HyREX as your search engine, this expects that -;; you use nnml or another one-file-per-message backend, because the -;; others doesn't support nnfolder. +;; * This expects that you use nnml or another one-file-per-message backend, +;; because the others doesn't support nnfolder. ;; * It can only search the mail backend's which are supported by one ;; search engine, because of different query languages. ;; * There are restrictions to the Wais setup. @@ -96,8 +95,7 @@ ;; like this : ;; (setq gnus-secondary-select-methods '( ;; (nnimap "" (nnimap-address "localhost") -;; (nnir-search-engine hyrex) -;; (nnir-hyrex-additional-switches ("-d" "ddl-nnimap.xml")) +;; (nnir-search-engine namazu) ;; ))) ;; Or you can define the global ones. The variables set in the mailer- ;; definition will be used first. @@ -227,18 +225,7 @@ ;; For maximum searching efficiency I have a cron job set to run this ;; command every four hours. -;; 3. HyREX -;; -;; The HyREX backend requires you to have one directory from where all -;; your relative paths are to, if you use them. This directory must be -;; set in the `nnir-hyrex-index-directory' variable, which defaults to -;; your home directory. You must also pass the base, class and -;; directory options or simply your dll to the `nnir-hyrex-programm' by -;; setting the `nnir-hyrex-additional-switches' variable accordently. -;; To function the `nnir-hyrex-remove-prefix' variable must also be -;; correct, see the documentation for `nnir-wais-remove-prefix' above. - -;; 4. find-grep +;; 3. find-grep ;; ;; The find-grep engine simply runs find(1) to locate eligible ;; articles and searches them with grep(1). This, of course, is much @@ -319,7 +306,6 @@ ;; are simple, but what about the article number? ;; - The article number is encoded in the `X-Gnus-Article-Number' ;; header of each mail. -;; - The HyREX engine supports nnfolder. ;; ;; * Support compressed mail files. Probably, just stripping off the ;; `.gz' or `.Z' file name extension is sufficient. @@ -403,8 +389,6 @@ ((group . "Group spec: "))) (namazu nnir-run-namazu ()) - (hyrex nnir-run-hyrex - ((group . "Group spec: "))) (find-grep nnir-run-find-grep ((grep-options . "Grep options: ")))) "Alist of supported search engines. @@ -575,40 +559,6 @@ :type '(regexp) :group 'nnir) -;; HyREX engine, see - -(defcustom nnir-hyrex-program "nnir-search" - "*Name of the nnir-search executable." - :type '(string) - :group 'nnir) - -(defcustom nnir-hyrex-additional-switches '() - "*A list of strings, to be given as additional arguments for nnir-search. -Note that this should be a list. Ie, do NOT use the following: - (setq nnir-hyrex-additional-switches \"-ddl ddl.xml -c nnir\") ; wrong ! -Instead, use this: - (setq nnir-hyrex-additional-switches '(\"-ddl\" \"ddl.xml\" \"-c\" \"nnir\"))" - :type '(repeat (string)) - :group 'nnir) - -(defcustom nnir-hyrex-index-directory (getenv "HOME") - "*Index directory for HyREX." - :type '(directory) - :group 'nnir) - -(defcustom nnir-hyrex-remove-prefix (concat (getenv "HOME") "/Mail/") - "*The prefix to remove from each file name returned by HyREX -in order to get a group name (albeit with / instead of .). - -For example, suppose that HyREX returns file names such as -\"/home/john/Mail/mail/misc/42\". For this example, use the following -setting: (setq nnir-hyrex-remove-prefix \"/home/john/Mail/\") -Note the trailing slash. Removing this prefix gives \"mail/misc/42\". -`nnir' knows to remove the \"/42\" and to replace \"/\" with \".\" to -arrive at the correct group name, \"mail.misc\"." - :type '(directory) - :group 'nnir) - ;; Namazu engine, see (defcustom nnir-namazu-program "namazu" @@ -1356,85 +1306,6 @@ (> (nnir-artitem-rsv x) (nnir-artitem-rsv y))))))))) -;; HyREX interface -(defun nnir-run-hyrex (query server &optional group) - (save-excursion - (let ((artlist nil) - (groupspec (cdr (assq 'group query))) - (qstring (cdr (assq 'query query))) - (prefix (nnir-read-server-parm 'nnir-hyrex-remove-prefix server)) - score artno dirnam) - (when (and group groupspec) - (error (concat "It does not make sense to use a group spec" - " with process-marked groups."))) - (when group - (setq groupspec (gnus-group-real-name group))) - (when (and group (not (equal group (nnir-group-full-name groupspec server)))) - (message "%s vs. %s" group (nnir-group-full-name groupspec server)) - (error "Server with groupspec doesn't match group !")) - (set-buffer (get-buffer-create nnir-tmp-buffer)) - (erase-buffer) - (if groupspec - (message "Doing hyrex-search query %s on %s..." query groupspec) - (message "Doing hyrex-search query %s..." query)) - (let* ((cp-list - `( ,nnir-hyrex-program - nil ; input from /dev/null - t ; output - nil ; don't redisplay - "-i",(nnir-read-server-parm 'nnir-hyrex-index-directory server) ; index directory - ,@(nnir-read-server-parm 'nnir-hyrex-additional-switches server) - ,qstring ; the query, in hyrex-search format - )) - (exitstatus - (progn - (message "%s args: %s" nnir-hyrex-program - (mapconcat 'identity (cddddr cp-list) " ")) - (apply 'call-process cp-list)))) - (unless (or (null exitstatus) - (zerop exitstatus)) - (nnheader-report 'nnir "Couldn't run hyrex-search: %s" exitstatus) - ;; nnir-search failure reason is in this buffer, show it if - ;; the user wants it. - (when (> gnus-verbose 6) - (display-buffer nnir-tmp-buffer)))) ;; FIXME: Dont clear buffer ! - (if groupspec - (message "Doing hyrex-search query \"%s\" on %s...done" qstring groupspec) - (message "Doing hyrex-search query \"%s\"...done" qstring)) - (sit-for 0) - ;; nnir-search returns: - ;; for nnml/nnfolder: "filename mailid weigth" - ;; for nnimap: "group mailid weigth" - (goto-char (point-min)) - (delete-non-matching-lines "^\\S + [0-9]+ [0-9]+$") - ;; HyREX couldn't search directly in groups -- so filter out here. - (when groupspec - (keep-lines groupspec)) - ;; extract data from result lines - (goto-char (point-min)) - (while (re-search-forward - "\\(\\S +\\) \\([0-9]+\\) \\([0-9]+\\)" nil t) - (setq dirnam (match-string 1) - artno (match-string 2) - score (match-string 3)) - (when (string-match prefix dirnam) - (setq dirnam (replace-match "" t t dirnam))) - (push (vector (nnir-group-full-name - (gnus-replace-in-string dirnam "/" ".") server) - (string-to-number artno) - (string-to-number score)) - artlist)) - (message "Massaging hyrex-search output...done.") - (apply 'vector - (sort artlist - (function (lambda (x y) - (if (string-lessp (nnir-artitem-group x) - (nnir-artitem-group y)) - t - (< (nnir-artitem-number x) - (nnir-artitem-number y))))))) - ))) - ;; Namazu interface (defun nnir-run-namazu (query server &optional group) "Run given query against Namazu. Returns a vector of (group name, file name) ------------------------------------------------------------ revno: 102137 committer: Glenn Morris branch nick: trunk timestamp: Thu 2010-10-28 00:21:43 -0700 message: doc/Makefile fixes related to inclusion of emacsver.texi. * doc/lispref/Makefile.in (elisp.dvi, elisp.pdf): Also include $emacsdir. * doc/misc/Makefile.in (MAKEINFO, ENVADD): Add $emacsdir to include path. (($(infodir)/calc, calc.dvi, calc.pdf): Depend on emacsver.texi. ($(infodir)/efaq): Remove -I option now in $MAKEINFO. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2010-10-25 00:04:44 +0000 +++ doc/lispref/ChangeLog 2010-10-28 07:21:43 +0000 @@ -1,3 +1,7 @@ +2010-10-28 Glenn Morris + + * Makefile.in (elisp.dvi, elisp.pdf): Also include $emacsdir. + 2010-10-24 Eli Zaretskii * display.texi (Window Systems): Deprecate use of window-system as === modified file 'doc/lispref/Makefile.in' --- doc/lispref/Makefile.in 2010-10-11 01:57:48 +0000 +++ doc/lispref/Makefile.in 2010-10-28 07:21:43 +0000 @@ -109,7 +109,7 @@ $(MAKEINFO) -o $@ $< elisp.dvi: $(srcs) - $(TEXI2DVI) -I $(srcdir) -I $(texinfodir) $< + $(TEXI2DVI) -I $(srcdir) -I $(texinfodir) -I $(emacsdir) $< elisp.html: $(srcs) $(MAKEINFO) --html -o $@ $< @@ -118,7 +118,7 @@ $(DVIPS) -o $@ $< elisp.pdf: $(srcs) - $(TEXI2PDF) -I $(srcdir) -I $(texinfodir) $< + $(TEXI2PDF) -I $(srcdir) -I $(texinfodir) -I $(emacsdir) $< .PHONY: mostlyclean clean distclean maintainer-clean infoclean === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2010-10-25 12:24:44 +0000 +++ doc/misc/ChangeLog 2010-10-28 07:21:43 +0000 @@ -1,3 +1,9 @@ +2010-10-28 Glenn Morris + + * Makefile.in (MAKEINFO, ENVADD): Add $emacsdir to include path. + (($(infodir)/calc, calc.dvi, calc.pdf): Depend on emacsver.texi. + ($(infodir)/efaq): Remove -I option now in $MAKEINFO. + 2010-10-25 Daiki Ueno * epa.texi (Mail-mode integration): Add alternative key bindings === modified file 'doc/misc/Makefile.in' --- doc/misc/Makefile.in 2010-10-11 00:30:34 +0000 +++ doc/misc/Makefile.in 2010-10-28 07:21:43 +0000 @@ -37,12 +37,12 @@ ## Note that the setfilename command in the .texi files assumes this. infodir=../../info ## Directory with emacsver.texi. -## Currently only used by efaq; could be added to MAKEINFO. +## Currently only used by efaq and calc. emacsdir = $(srcdir)/../emacs # The makeinfo program is part of the Texinfo distribution. # Use --force so that it generates output even if there are errors. -MAKEINFO = makeinfo --force +MAKEINFO = makeinfo --force -I$(emacsdir) # Also add new entries to INFO_FILES in the top-level Makefile.in. INFO_TARGETS = \ @@ -198,7 +198,7 @@ TEXI2DVI = texi2dvi TEXI2PDF = texi2pdf -ENVADD = TEXINPUTS="$(srcdir):$(TEXINPUTS)" MAKEINFO="$(MAKEINFO) -I$(srcdir)" +ENVADD = TEXINPUTS="$(srcdir):$(emacsdir):$(TEXINPUTS)" MAKEINFO="$(MAKEINFO) -I$(srcdir)" mkinfodir = @cd ${srcdir}; test -d ${infodir} || mkdir ${infodir} || test -d ${infodir} @@ -244,12 +244,12 @@ $(ENVADD) $(TEXI2PDF) $< calc : $(infodir)/calc -$(infodir)/calc: calc.texi +$(infodir)/calc: calc.texi $(emacsdir)/emacsver.texi $(mkinfodir) cd $(srcdir); $(MAKEINFO) $< -calc.dvi: ${srcdir}/calc.texi +calc.dvi: ${srcdir}/calc.texi $(emacsdir)/emacsver.texi $(ENVADD) $(TEXI2DVI) $< -calc.pdf: ${srcdir}/calc.texi +calc.pdf: ${srcdir}/calc.texi $(emacsdir)/emacsver.texi $(ENVADD) $(TEXI2PDF) $< ccmode : $(infodir)/ccmode @@ -381,7 +381,7 @@ efaq : $(infodir)/efaq $(infodir)/efaq: faq.texi $(emacsdir)/emacsver.texi $(mkinfodir) - cd $(srcdir); $(MAKEINFO) -I $(emacsdir) $< + cd $(srcdir); $(MAKEINFO) $< faq.dvi: ${srcdir}/faq.texi $(emacsdir)/emacsver.texi $(ENVADD) $(TEXI2DVI) $< faq.pdf: ${srcdir}/faq.texi $(emacsdir)/emacsver.texi === modified file 'doc/misc/calc.texi' --- doc/misc/calc.texi 2010-10-24 22:37:44 +0000 +++ doc/misc/calc.texi 2010-10-28 07:21:43 +0000 @@ -7,7 +7,7 @@ @setchapternewpage odd @comment %**end of header (This is for running Texinfo on a region.) -@include ../emacs/emacsver.texi +@include emacsver.texi @c The following macros are used for conditional output for single lines. @c @texline foo @@ -36585,7 +36585,3 @@ @bye - -@ignore - arch-tag: 77a71809-fa4d-40be-b2cc-da3e8fb137c0 -@end ignore ------------------------------------------------------------ revno: 102136 committer: Glenn Morris branch nick: trunk timestamp: Thu 2010-10-28 00:05:00 -0700 message: Move ns-specific menu-bar code from term/ns-win.el to menu-bar.el. * lisp/term/ns-win.el (global-map, menu-bar-final-items, menu-bar-help-menu): Move menu-bar related settings to ../menu-bar.el. * lisp/menu-bar.el (global-map, menu-bar-final-items, menu-bar-help-menu): Move ns-specific settings here from term/ns-win.el. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-10-28 03:49:40 +0000 +++ lisp/ChangeLog 2010-10-28 07:05:00 +0000 @@ -1,5 +1,10 @@ 2010-10-28 Glenn Morris + * term/ns-win.el (global-map, menu-bar-final-items, menu-bar-help-menu): + Move menu-bar related settings to ../menu-bar.el. + * menu-bar.el (global-map, menu-bar-final-items, menu-bar-help-menu): + Move ns-specific settings here from term/ns-win.el. + * simple.el (x-selection-owner-p): Remove unused declaration. 2010-10-28 Stefan Monnier === modified file 'lisp/menu-bar.el' --- lisp/menu-bar.el 2010-10-25 00:48:26 +0000 +++ lisp/menu-bar.el 2010-10-28 07:05:00 +0000 @@ -35,14 +35,33 @@ (define-key global-map [menu-bar] (make-sparse-keymap "menu-bar"))) (defvar menu-bar-help-menu (make-sparse-keymap "Help")) -;; 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)) - -(define-key global-map [menu-bar help-menu] (cons (purecopy "Help") menu-bar-help-menu)) +(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)) + (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. + (define-key global-map [menu-bar quit] + `(menu-item ,(purecopy "Quit") save-buffers-kill-emacs + :help ,(purecopy "Save unsaved buffers, then exit"))) + (define-key global-map [menu-bar hide-app] + `(menu-item ,(purecopy "Hide") ns-do-hide-emacs + :help ,(purecopy "Hide Emacs")))) + (define-key global-map [menu-bar services] ; set-up in ns-win + (cons (purecopy "Services") (make-sparse-keymap "Services")))) + +;; If running under GNUstep, "Help" is moved and renamed "Info" (see below). +(or (and (featurep 'ns) + (not (eq system-type 'darwin))) + (define-key global-map [menu-bar help-menu] + (cons (purecopy "Help") menu-bar-help-menu))) + (defvar menu-bar-tools-menu (make-sparse-keymap "Tools")) -(define-key global-map [menu-bar tools] (cons (purecopy "Tools") menu-bar-tools-menu)) +(define-key global-map [menu-bar tools] + (cons (purecopy "Tools") menu-bar-tools-menu)) ;; This definition is just to show what this looks like. ;; It gets modified in place when menu-bar-update-buffers is called. (defvar global-buffers-menu-map (make-sparse-keymap "Buffers")) @@ -52,9 +71,17 @@ (define-key global-map [menu-bar options] (cons (purecopy "Options") menu-bar-options-menu)) (defvar menu-bar-edit-menu (make-sparse-keymap "Edit")) -(define-key global-map [menu-bar edit] (cons (purecopy "Edit") menu-bar-edit-menu)) +(define-key global-map [menu-bar edit] + (cons (purecopy "Edit") menu-bar-edit-menu)) (defvar menu-bar-file-menu (make-sparse-keymap "File")) -(define-key global-map [menu-bar file] (cons (purecopy "File") menu-bar-file-menu)) +(define-key global-map [menu-bar file] + (cons (purecopy "File") menu-bar-file-menu)) + +;; Put "Help" menu at the front, called "Info". +(and (featurep 'ns) + (not (eq system-type 'darwin)) + (define-key global-map [menu-bar help-menu] + (cons (purecopy "Info") menu-bar-help-menu))) ;; This alias is for compatibility with 19.28 and before. (defvar menu-bar-files-menu menu-bar-file-menu) @@ -458,7 +485,6 @@ ,(purecopy "Delete the text in region between mark and current position"))) (defvar yank-menu (cons (purecopy "Select Yank") nil)) (fset 'yank-menu (cons 'keymap yank-menu)) -;; The ns differences here seem silly. (define-key menu-bar-edit-menu (if (featurep 'ns) [select-paste] [paste-from-menu]) ;; ns-win.el said: Change text to be more consistent with @@ -1028,47 +1054,47 @@ (defvar menu-bar-showhide-tool-bar-menu (make-sparse-keymap "Tool-bar")) (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-left] - `(menu-item ,(purecopy "On the left") + `(menu-item ,(purecopy "On the left") menu-bar-showhide-tool-bar-menu-customize-enable-left :help ,(purecopy "Tool-bar at the left side") :visible (display-graphic-p) - :button - (:radio . (and tool-bar-mode + :button + (:radio . (and tool-bar-mode (eq (frame-parameter nil 'tool-bar-position) 'left))))) (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-right] - `(menu-item ,(purecopy "On the right") + `(menu-item ,(purecopy "On the right") menu-bar-showhide-tool-bar-menu-customize-enable-right :help ,(purecopy "Tool-bar at the right side") :visible (display-graphic-p) :button - (:radio . (and tool-bar-mode + (:radio . (and tool-bar-mode (eq (frame-parameter nil 'tool-bar-position) 'right))))) (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-bottom] - `(menu-item ,(purecopy "On the bottom") + `(menu-item ,(purecopy "On the bottom") menu-bar-showhide-tool-bar-menu-customize-enable-bottom :help ,(purecopy "Tool-bar at the bottom") :visible (display-graphic-p) :button - (:radio . (and tool-bar-mode + (:radio . (and tool-bar-mode (eq (frame-parameter nil 'tool-bar-position) 'bottom))))) (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-top] - `(menu-item ,(purecopy "On the top") + `(menu-item ,(purecopy "On the top") menu-bar-showhide-tool-bar-menu-customize-enable-top :help ,(purecopy "Tool-bar at the top") :visible (display-graphic-p) :button - (:radio . (and tool-bar-mode + (:radio . (and tool-bar-mode (eq (frame-parameter nil 'tool-bar-position) 'top))))) (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-none] - `(menu-item ,(purecopy "None") + `(menu-item ,(purecopy "None") menu-bar-showhide-tool-bar-menu-customize-disable :help ,(purecopy "Turn tool-bar off") :visible (display-graphic-p) @@ -1688,6 +1714,13 @@ `(menu-item ,(purecopy "Emacs Tutorial") help-with-tutorial :help ,(purecopy "Learn how to use Emacs"))) +;; In OS X it's in the app menu already. +;; FIXME? There already is an "About Emacs" (sans ...) entry in the Help menu. +(and (featurep 'ns) + (not (eq system-type 'darwin)) + (define-key menu-bar-help-menu [info-panel] + `(menu-item ,(purecopy "About Emacs...") ns-do-emacs-info-panel))) + (defun menu-bar-menu-frame-live-and-visible-p () "Return non-nil if the menu frame is alive and visible. The menu frame is the frame for which we are updating the menu." === modified file 'lisp/term/ns-win.el' --- lisp/term/ns-win.el 2010-10-27 07:39:34 +0000 +++ lisp/term/ns-win.el 2010-10-28 07:05:00 +0000 @@ -186,48 +186,6 @@ (declare-function ns-do-applescript "nsfns.m" (script)) (defalias 'do-applescript 'ns-do-applescript) -;; Add a couple of menus and rearrange some others; easiest just to redo toplvl -;; Note keymap defns must be given last-to-first -(define-key global-map [menu-bar] (make-sparse-keymap "menu-bar")) - -(setq menu-bar-final-items - (cond ((eq system-type 'darwin) - '(buffer services help-menu)) - ;; Otherwise, GNUstep. - (t - '(buffer services hide-app quit)))) - -;; Add standard top-level items to GNUstep menu. -(unless (eq system-type 'darwin) - (define-key global-map [menu-bar quit] '("Quit" . save-buffers-kill-emacs)) - (define-key global-map [menu-bar hide-app] '("Hide" . ns-do-hide-emacs))) - -(define-key global-map [menu-bar services] - (cons "Services" (make-sparse-keymap "Services"))) -(define-key global-map [menu-bar buffer] - (cons "Buffers" global-buffers-menu-map)) -;; (cons "Buffers" (make-sparse-keymap "Buffers"))) -(define-key global-map [menu-bar tools] (cons "Tools" menu-bar-tools-menu)) -(define-key global-map [menu-bar options] (cons "Options" menu-bar-options-menu)) -(define-key global-map [menu-bar edit] (cons "Edit" menu-bar-edit-menu)) -(define-key global-map [menu-bar file] (cons "File" menu-bar-file-menu)) - -;; If running under GNUstep, rename "Help" to "Info" -(cond ((eq system-type 'darwin) - (define-key global-map [menu-bar help-menu] - (cons "Help" menu-bar-help-menu))) - (t - (let ((contents (reverse (cdr menu-bar-help-menu)))) - (setq menu-bar-help-menu - (append (list 'keymap) (cdr contents) (list "Info")))) - (define-key global-map [menu-bar help-menu] - (cons "Info" menu-bar-help-menu)))) - -(if (not (eq system-type 'darwin)) - ;; in OS X it's in the app menu already - (define-key menu-bar-help-menu [info-panel] - '("About Emacs..." . ns-do-emacs-info-panel))) - ;;;; Services (declare-function ns-perform-service "nsfns.m" (service send)) ------------------------------------------------------------ revno: 102135 committer: Katsumi Yamaoka branch nick: trunk timestamp: Thu 2010-10-28 06:37:35 +0000 message: gnus-art.el: Improve MIME part functions. gnus-art.el (gnus-article-jump-to-part): Error on no part; fix prompt. (gnus-mime-copy-part): Check coding system, not charset. (gnus-mime-view-part-externally): Never remove part. (gnus-mime-view-part-internally): Don't remove part here. (gnus-article-part-wrapper): Make sure MIME tag is visible. (gnus-article-goto-part): Go to displayed or preferred subpart if it is multipart/alternative. mm-decode.el (mm-display-part): Take optional arg `force'. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2010-10-27 22:08:36 +0000 +++ lisp/gnus/ChangeLog 2010-10-28 06:37:35 +0000 @@ -1,3 +1,15 @@ +2010-10-28 Katsumi Yamaoka + + * gnus-art.el (gnus-article-jump-to-part): Error on no part; fix prompt. + (gnus-mime-copy-part): Check coding system, not charset. + (gnus-mime-view-part-externally): Never remove part. + (gnus-mime-view-part-internally): Don't remove part here. + (gnus-article-part-wrapper): Make sure MIME tag is visible. + (gnus-article-goto-part): Go to displayed or preferred subpart if it is + multipart/alternative. + + * mm-decode.el (mm-display-part): Take optional arg `force'. + 2010-10-26 Julien Danjou * gnus-group.el (gnus-group-default-list-level): Add this function to === modified file 'lisp/gnus/gnus-art.el' --- lisp/gnus/gnus-art.el 2010-10-20 22:29:38 +0000 +++ lisp/gnus/gnus-art.el 2010-10-28 06:37:35 +0000 @@ -4811,11 +4811,17 @@ (defun gnus-article-jump-to-part (n) "Jump to MIME part N." (interactive "P") - (pop-to-buffer gnus-article-buffer) - ;; FIXME: why is it necessary? - (sit-for 0) - (let ((parts (length gnus-article-mime-handle-alist))) - (or n (setq n (read-number (format "Jump to part (2..%s): " parts)))) + (let ((parts (with-current-buffer gnus-article-buffer + (length gnus-article-mime-handle-alist)))) + (when (zerop parts) + (error "No such part")) + (pop-to-buffer gnus-article-buffer) + ;; FIXME: why is it necessary? + (sit-for 0) + (or n + (setq n (if (= parts 1) + 1 + (read-number (format "Jump to part (1..%s): " parts))))) (unless (and (integerp n) (<= n parts) (>= n 1)) (setq n (progn @@ -5115,7 +5121,7 @@ (if (or coding-system (and charset (setq coding-system (mm-charset-to-coding-system charset)) - (not (eq charset 'ascii)))) + (not (eq coding-system 'ascii)))) (progn (mm-enable-multibyte) (insert (mm-decode-coding-string contents coding-system)) @@ -5290,9 +5296,7 @@ (gnus-mime-view-part-as-type nil (lambda (type) (stringp (mailcap-mime-info type)))) (when handle - (if (mm-handle-undisplayer handle) - (mm-remove-part handle) - (mm-display-part handle)))))) + (mm-display-part handle nil t))))) (defun gnus-mime-view-part-internally (&optional handle) "View the MIME part under point with an internal viewer. @@ -5311,9 +5315,7 @@ (gnus-mime-view-part-as-type nil (lambda (type) (mm-inlinable-p handle type))) (when handle - (if (mm-handle-undisplayer handle) - (mm-remove-part handle) - (gnus-bind-safe-url-regexp (mm-display-part handle))))))) + (gnus-bind-safe-url-regexp (mm-display-part handle)))))) (defun gnus-mime-action-on-part (&optional action) "Do something with the MIME attachment at \(point\)." @@ -5376,6 +5378,10 @@ (when (gnus-article-goto-part n) ;; We point the cursor and the arrow at the MIME button ;; when the `function' prompt the user for something. + (unless (and (pos-visible-in-window-p) + (> (count-lines (point) (window-end)) + (/ (1- (window-height)) 3))) + (recenter (/ (1- (window-height)) 3))) (let ((cursor-in-non-selected-windows t) (overlay-arrow-string "=>") (overlay-arrow-position (point-marker))) @@ -5387,11 +5393,10 @@ (funcall function)) (interactive (call-interactively - function - (cdr (assq n gnus-article-mime-handle-alist)))) + function (get-text-property (point) 'gnus-data))) (t (funcall function - (cdr (assq n gnus-article-mime-handle-alist))))) + (get-text-property (point) 'gnus-data)))) (set-marker overlay-arrow-position nil) (unless gnus-auto-select-part (gnus-select-frame-set-input-focus frame) @@ -5556,7 +5561,35 @@ (defun gnus-article-goto-part (n) "Go to MIME part N." - (gnus-goto-char (text-property-any (point-min) (point-max) 'gnus-part n))) + (let ((start (text-property-any (point-min) (point-max) 'gnus-part n)) + part handle end next handles) + (when start + (goto-char start) + (if (setq handle (get-text-property start 'gnus-data)) + start + ;; Go to the displayed subpart, assuming this is multipart/alternative. + (setq part start + end (point-at-eol)) + (while (and (not handle) + part + (< part end) + (setq next (text-property-not-all part end + 'gnus-data nil))) + (setq part next + handle (get-text-property part 'gnus-data)) + (push (cons handle part) handles) + (unless (mm-handle-displayed-p handle) + (setq handle nil + part (text-property-any part end 'gnus-data nil)))) + (unless handle + ;; No subpart is displayed, so we find preferred one. + (setq part + (cdr (assq (mm-preferred-alternative + (nreverse (mapcar 'car handles))) + handles)))) + (if part + (goto-char (1+ part)) + start))))) (defun gnus-insert-mime-button (handle gnus-tmp-id &optional displayed) (let ((gnus-tmp-name === modified file 'lisp/gnus/mm-decode.el' --- lisp/gnus/mm-decode.el 2010-10-27 03:59:59 +0000 +++ lisp/gnus/mm-decode.el 2010-10-28 06:37:35 +0000 @@ -696,13 +696,14 @@ (autoload 'mailcap-parse-mailcaps "mailcap") (autoload 'mailcap-mime-info "mailcap") -(defun mm-display-part (handle &optional no-default) +(defun mm-display-part (handle &optional no-default force) "Display the MIME part represented by HANDLE. Returns nil if the part is removed; inline if displayed inline; external if displayed external." (save-excursion (mailcap-parse-mailcaps) - (if (mm-handle-displayed-p handle) + (if (and (not force) + (mm-handle-displayed-p handle)) (mm-remove-part handle) (let* ((ehandle (if (equal (mm-handle-media-type handle) "message/external-body")