# HG changeset patch # User Katsumi Yamaoka # Date 1282085231 0 # Node ID 46f382b913d60c30f6ed465828e1e4c25d662484 # Parent 37af1f06dafa19476e17478698dda576e2557fdc# Parent c917fbc9b2943d5ae46a72cbff74c7f775a6df4f Merge from mainline. diff -r 37af1f06dafa -r 46f382b913d6 lisp/ChangeLog --- a/lisp/ChangeLog Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/ChangeLog Tue Aug 17 22:47:11 2010 +0000 @@ -1,3 +1,60 @@ +2010-08-17 Stefan Monnier + + * emacs-lisp/lisp.el (up-list): Obey forward-sexp-function if set. + + Font-lock '...' strings, plus various simplifications and fixes. + * progmodes/octave-mod.el (octave-font-lock-keywords): Use regexp-opt. + (octave-font-lock-close-quotes): New function. + (octave-font-lock-syntactic-keywords): New var. + (octave-mode): Use it. Set beginning-of-defun-function. + (octave-mode-map): Don't override the -defun commands. + (octave-mode-menu): Pass it directly to easy-menu-define; + remove (now generic) -defun commands; use info-lookup-symbol. + (octave-block-match-alist): Fix up last change so that + octave-close-block uses the more specific keyword. + (info-lookup-mode): Silence byte-compiler. + (octave-beginning-of-defun): Not interactive any more. + Optimize slightly. + (octave-end-of-defun, octave-mark-defun, octave-in-defun-p): Remove. + (octave-indent-defun, octave-send-defun): Use mark-defun instead. + (octave-completion-at-point-function): Make sure point is within + beg..end. + (octave-reindent-then-newline-and-indent): + Use reindent-then-newline-and-indent. + (octave-add-octave-menu): Remove. + +2010-08-17 Jan Djärv + + * mail/emacsbug.el (report-emacs-bug-insert-to-mailer) + (report-emacs-bug-can-use-xdg-email): New functions. + (report-emacs-bug): Set can-xdg-email to result of + report-emacs-bug-can-use-xdg-email. If can-xdg-email bind + \C-cm to report-emacs-bug-insert-to-mailer and add help text + about it. + + * net/browse-url.el (browse-url-default-browser): Add cond + for browse-url-xdg-open. + (browse-url-can-use-xdg-open, browse-url-xdg-open): New functions. + +2010-08-17 Glenn Morris + + * progmodes/cc-engine.el (c-new-BEG, c-new-END) + (c-fontify-recorded-types-and-refs): Define for compiler. + * progmodes/cc-mode.el (c-new-BEG, c-new-END): Move definitions + before use. + + * calendar/icalendar.el (icalendar--convert-recurring-to-diary): + Fix format call. + +2010-08-17 Michael Albinus + + * net/tramp.el (tramp-handle-make-symbolic-link): Flush file + properties. + (tramp-handle-process-file): Call the program in a subshell, in + order to preserve working directory. + (tramp-action-password): Hide password prompt before next run. + (tramp-process-actions): Widen connection buffer for the trace. + 2010-08-16 Deniz Dogan * net/rcirc.el (rcirc-log-process-buffers): New option. @@ -16,8 +73,8 @@ 2010-08-15 Chong Yidong * mouse.el (mouse--drag-set-mark-and-point): New function. - (mouse-drag-track): Use LOCATION arg to push-mark. Use - mouse--drag-set-mark-and-point to take click-count into + (mouse-drag-track): Use LOCATION arg to push-mark. + Use mouse--drag-set-mark-and-point to take click-count into consideration when updating point and mark (Bug#6840). 2010-08-15 Chong Yidong @@ -27,8 +84,8 @@ 2010-08-14 Štěpán Němec (tiny change) - * font-lock.el (lisp-font-lock-keywords-2): Add - combine-after-change-calls, condition-case-no-debug, + * font-lock.el (lisp-font-lock-keywords-2): + Add combine-after-change-calls, condition-case-no-debug, with-demoted-errors, and with-silent-modifications (Bug#6025). 2010-08-14 Kevin Ryde @@ -53,8 +110,8 @@ (menu-bar-showhide-tool-bar-menu-customize-enable-left) (menu-bar-showhide-tool-bar-menu-customize-enable-right) (menu-bar-showhide-tool-bar-menu-customize-enable-top) - (menu-bar-showhide-tool-bar-menu-customize-enable-bottom): Call - menu-bar-set-tool-bar-position. + (menu-bar-showhide-tool-bar-menu-customize-enable-bottom): + Call menu-bar-set-tool-bar-position. 2010-08-12 Stefan Monnier diff -r 37af1f06dafa -r 46f382b913d6 lisp/calendar/icalendar.el --- a/lisp/calendar/icalendar.el Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/calendar/icalendar.el Tue Aug 17 22:47:11 2010 +0000 @@ -2092,6 +2092,7 @@ (format "(diary-cyclic %d %s) " (* interval 7) dtstart-conv)) + dtstart-conv (if count until-1-conv until-conv) )) (setq result diff -r 37af1f06dafa -r 46f382b913d6 lisp/emacs-lisp/lisp.el --- a/lisp/emacs-lisp/lisp.el Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/emacs-lisp/lisp.el Tue Aug 17 22:47:11 2010 +0000 @@ -142,7 +142,13 @@ (or arg (setq arg 1)) (let ((inc (if (> arg 0) 1 -1))) (while (/= arg 0) - (goto-char (or (scan-lists (point) inc 1) (buffer-end arg))) + (if forward-sexp-function + (condition-case err + (while (let ((pos (point))) + (forward-sexp inc) + (/= (point) pos))) + (scan-error (goto-char (nth 2 err)))) + (goto-char (or (scan-lists (point) inc 1) (buffer-end arg)))) (setq arg (- arg inc))))) (defun kill-sexp (&optional arg) diff -r 37af1f06dafa -r 46f382b913d6 lisp/gnus/ChangeLog --- a/lisp/gnus/ChangeLog Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/gnus/ChangeLog Tue Aug 17 22:47:11 2010 +0000 @@ -1,3 +1,13 @@ +2010-08-17 Glenn Morris + + * gnus-sync.el: Require gnus components whose functions are used. + + * gnus-art.el (bookmark-make-record-function): + * gnus-sum.el (bookmark-yank-point, bookmark-current-bookmark): + Declare for compiler. + + * mm-url.el (mml-compute-boundary): Autoload. + 2010-08-15 Katsumi Yamaoka * gnus-start.el (gnus-start-draft-setup): Move doc string forward. diff -r 37af1f06dafa -r 46f382b913d6 lisp/gnus/gnus-art.el --- a/lisp/gnus/gnus-art.el Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/gnus/gnus-art.el Tue Aug 17 22:47:11 2010 +0000 @@ -4414,6 +4414,8 @@ (gnus-run-hooks 'gnus-article-menu-hook))) +(defvar bookmark-make-record-function) + (defun gnus-article-mode () "Major mode for displaying an article. diff -r 37af1f06dafa -r 46f382b913d6 lisp/gnus/gnus-sum.el --- a/lisp/gnus/gnus-sum.el Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/gnus/gnus-sum.el Tue Aug 17 22:47:11 2010 +0000 @@ -12626,6 +12626,8 @@ (declare-function bookmark-prop-get "bookmark" (bookmark prop)) (declare-function bookmark-default-handler "bookmark" (bmk)) (declare-function bookmark-get-bookmark-record "bookmark" (bmk)) +(defvar bookmark-yank-point) +(defvar bookmark-current-bookmark) (defun gnus-summary-bookmark-make-record () "Make a bookmark entry for a Gnus summary buffer." diff -r 37af1f06dafa -r 46f382b913d6 lisp/gnus/gnus-sync.el --- a/lisp/gnus/gnus-sync.el Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/gnus/gnus-sync.el Tue Aug 17 22:47:11 2010 +0000 @@ -43,6 +43,8 @@ ;;; Code: (eval-when-compile (require 'cl)) +(require 'gnus) +(require 'gnus-start) (require 'gnus-util) (defgroup gnus-sync nil diff -r 37af1f06dafa -r 46f382b913d6 lisp/gnus/mm-url.el --- a/lisp/gnus/mm-url.el Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/gnus/mm-url.el Tue Aug 17 22:47:11 2010 +0000 @@ -418,6 +418,8 @@ (mm-url-form-encode-xwfu (cdr data)))) pairs "&")) +(autoload 'mml-compute-boundary "mml") + (defun mm-url-encode-multipart-form-data (pairs &optional boundary) "Return PAIRS encoded in multipart/form-data." ;; RFC1867 diff -r 37af1f06dafa -r 46f382b913d6 lisp/mail/emacsbug.el --- a/lisp/mail/emacsbug.el Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/mail/emacsbug.el Tue Aug 17 22:47:11 2010 +0000 @@ -74,6 +74,52 @@ (declare-function message-sort-headers "message" ()) (defvar message-strip-special-text-properties) +(defun report-emacs-bug-can-use-xdg-email () + "Check if xdg-email can be used, i.e. we are on Gnome, KDE or xfce4." + (and (getenv "DISPLAY") + (executable-find "xdg-email") + (or (getenv "GNOME_DESKTOP_SESSION_ID") + ;; GNOME_DESKTOP_SESSION_ID is deprecated, check on Dbus also. + (condition-case nil + (eq 0 (call-process + "dbus-send" nil nil nil + "--dest=org.gnome.SessionManager" + "--print-reply" + "/org/gnome/SessionManager" + "org.gnome.SessionManager.CanShutdown")) + (error nil)) + (equal (getenv "KDE_FULL_SESSION") "true") + (condition-case nil + (eq 0 (call-process + "/bin/sh" nil nil nil + "-c" + "xprop -root _DT_SAVE_MODE|grep xfce4")) + (error nil))))) + +(defun report-emacs-bug-insert-to-mailer () + (interactive) + (save-excursion + (let* ((to (progn + (goto-char (point-min)) + (forward-line) + (and (looking-at "^To: \\(.*\\)") + (match-string-no-properties 1)))) + (subject (progn + (forward-line) + (and (looking-at "^Subject: \\(.*\\)") + (match-string-no-properties 1)))) + (body (progn + (forward-line 2) + (if (> (point-max) (point)) + (buffer-substring-no-properties (point) (point-max)))))) + (if (and to subject body) + (start-process "xdg-email" nil "xdg-email" + "--subject" subject + "--body" body + (concat "mailto:" to)) + (error "Subject, To or body not found"))))) + + ;;;###autoload (defun report-emacs-bug (topic &optional recent-keys) "Report a bug in GNU Emacs. @@ -93,6 +139,7 @@ (prompt-properties '(field emacsbug-prompt intangible but-helpful rear-nonsticky t)) + (can-xdg-email (report-emacs-bug-can-use-xdg-email)) user-point message-end-point) (setq message-end-point (with-current-buffer (get-buffer-create "*Messages*") @@ -226,6 +273,9 @@ ;; This is so the user has to type something in order to send easily. (use-local-map (nconc (make-sparse-keymap) (current-local-map))) (define-key (current-local-map) "\C-c\C-i" 'report-emacs-bug-info) + (if can-xdg-email + (define-key (current-local-map) "\C-cm" + 'report-emacs-bug-insert-to-mailer)) ;; Could test major-mode instead. (cond ((memq mail-user-agent '(message-user-agent gnus-user-agent)) (setq report-emacs-bug-send-command "message-send-and-exit" @@ -245,6 +295,9 @@ report-emacs-bug-send-command)))) (princ (substitute-command-keys " Type \\[kill-buffer] RET to cancel (don't send it).\n")) + (if can-xdg-email + (princ (substitute-command-keys + " Type \\[report-emacs-bug-insert-to-mailer] to insert text to you preferred mail program.\n"))) (terpri) (princ (substitute-command-keys " Type \\[report-emacs-bug-info] to visit in Info the Emacs Manual section diff -r 37af1f06dafa -r 46f382b913d6 lisp/net/browse-url.el --- a/lisp/net/browse-url.el Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/net/browse-url.el Tue Aug 17 22:47:11 2010 +0000 @@ -892,6 +892,7 @@ Galeon, Konqueror, Netscape, Mosaic, Lynx in an xterm, and then W3." (apply (cond + ((browse-url-can-use-xdg-open) 'browse-url-xdg-open) ((executable-find browse-url-gnome-moz-program) 'browse-url-gnome-moz) ((executable-find browse-url-mozilla-program) 'browse-url-mozilla) ((executable-find browse-url-firefox-program) 'browse-url-firefox) @@ -905,6 +906,41 @@ (lambda (&rest ignore) (error "No usable browser found")))) url args)) +(defun browse-url-can-use-xdg-open () + "Check if xdg-open can be used, i.e. we are on Gnome, KDE or xfce4." + (and (getenv "DISPLAY") + (executable-find "xdg-open") + ;; xdg-open may call gnome-open and that does not wait for its child + ;; to finish. This child may then be killed when the parent dies. + ;; Use nohup to work around. + (executable-find "nohup") + (or (getenv "GNOME_DESKTOP_SESSION_ID") + ;; GNOME_DESKTOP_SESSION_ID is deprecated, check on Dbus also. + (condition-case nil + (eq 0 (call-process + "dbus-send" nil nil nil + "--dest=org.gnome.SessionManager" + "--print-reply" + "/org/gnome/SessionManager" + "org.gnome.SessionManager.CanShutdown")) + (error nil)) + (equal (getenv "KDE_FULL_SESSION") "true") + (condition-case nil + (eq 0 (call-process + "/bin/sh" nil nil nil + "-c" + "xprop -root _DT_SAVE_MODE|grep xfce4")) + (error nil))))) + + +;;;###autoload +(defun browse-url-xdg-open (url &optional new-window) + (interactive (browse-url-interactive-arg "URL: ")) + (call-process "/bin/sh" nil nil nil + "-c" + (concat "nohup xdg-open " url + ">/dev/null 2>&1 %s" command stderr))) - ;; Send the command. It might not return in time, so we protect it. + ;; Send the command. It might not return in time, so we protect + ;; it. Call it in a subshell, in order to preserve working + ;; directory. (condition-case nil (unwind-protect (setq ret @@ -4646,7 +4651,7 @@ v (format "\\cd %s; %s" (tramp-shell-quote-argument localname) command) - nil t)) + t t)) ;; We should show the output anyway. (when outbuf (with-current-buffer outbuf @@ -6698,8 +6703,10 @@ "Query the user for a password." (with-current-buffer (process-buffer proc) (tramp-check-for-regexp proc tramp-password-prompt-regexp) - (tramp-message vec 3 "Sending %s" (match-string 1))) - (tramp-enter-password proc)) + (tramp-message vec 3 "Sending %s" (match-string 1)) + (tramp-enter-password proc) + ;; Hide password prompt. + (narrow-to-region (point-max) (point-max)))) (defun tramp-action-succeed (proc vec) "Signal success in finding shell prompt." @@ -6810,6 +6817,7 @@ (tramp-process-one-action proc vec actions)) (tramp-process-one-action proc vec actions))))) (with-current-buffer (tramp-get-connection-buffer vec) + (widen) (tramp-message vec 6 "\n%s" (buffer-string))) (unless (eq exit 'ok) (tramp-clear-passwd vec) diff -r 37af1f06dafa -r 46f382b913d6 lisp/newcomment.el --- a/lisp/newcomment.el Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/newcomment.el Tue Aug 17 22:47:11 2010 +0000 @@ -945,12 +945,12 @@ (delete-char n) (setq ,bindent (- ,bindent n))))))))))) -;; Compute the number of extra comment starter characters -;; (extra semicolons in Lisp mode, extra stars in C mode, etc.) -;; If ARG is non-nil, just follow ARG. -;; If the comment-starter is multi-char, just follow ARG. -;; Otherwise obey comment-add, and double it if EXTRA is non-nil. (defun comment-add (arg) + "Compute the number of extra comment starter characters +\(extra semicolons in Lisp mode, extra stars in C mode, etc.) +If ARG is non-nil, just follow ARG. +If the comment starter is multi-char, just follow ARG. +Otherwise obey `comment-add'." (if (and (null arg) (= (string-match "[ \t]*\\'" comment-start) 1)) (* comment-add 1) (1- (prefix-numeric-value arg)))) diff -r 37af1f06dafa -r 46f382b913d6 lisp/org/ChangeLog --- a/lisp/org/ChangeLog Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/org/ChangeLog Tue Aug 17 22:47:11 2010 +0000 @@ -1,3 +1,14 @@ +2010-08-17 Glenn Morris + + * ob.el (tramp-compat-make-temp-file, org-edit-src-code) + (org-entry-get, org-table-import): Fix declarations. + (org-match-string-no-properties): Remove unnecessary declaration. + * ob-sh.el (org-babel-comint-in-buffer) + (org-babel-comint-wait-for-output, org-babel-comint-buffer-livep) + (org-babel-comint-with-output): Remove unnecessary declarations. + * ob-R.el (orgtbl-to-tsv): Fix declaration. + * org-list.el (org-entry-get): Fix declaration. + 2010-07-19 Eric Schulte * ob-C.el: New file. diff -r 37af1f06dafa -r 46f382b913d6 lisp/org/ob-R.el --- a/lisp/org/ob-R.el Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/org/ob-R.el Tue Aug 17 22:47:11 2010 +0000 @@ -33,7 +33,7 @@ (require 'ob-eval) (eval-when-compile (require 'cl)) -(declare-function orgtbl-to-tsv "ob-table" (table params)) +(declare-function orgtbl-to-tsv "org-table" (table params)) (declare-function R "ext:essd-r" (&optional start-args)) (declare-function inferior-ess-send-input "ext:ess-inf" ()) diff -r 37af1f06dafa -r 46f382b913d6 lisp/org/ob-sh.el --- a/lisp/org/ob-sh.el Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/org/ob-sh.el Tue Aug 17 22:47:11 2010 +0000 @@ -34,10 +34,6 @@ (eval-when-compile (require 'cl)) (declare-function org-babel-ref-variables "ob-ref" (params)) -(declare-function org-babel-comint-in-buffer "ob-comint" (buffer &rest body)) -(declare-function org-babel-comint-wait-for-output "ob-comint" (buffer)) -(declare-function org-babel-comint-buffer-livep "ob-comint" (buffer)) -(declare-function org-babel-comint-with-output "ob-comint" (meta &rest body)) (declare-function orgtbl-to-generic "org-table" (table params)) (defvar org-babel-default-header-args:sh '()) diff -r 37af1f06dafa -r 46f382b913d6 lisp/org/ob.el --- a/lisp/org/ob.el Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/org/ob.el Tue Aug 17 22:47:11 2010 +0000 @@ -25,7 +25,7 @@ ;;; Commentary: ;; See the online documentation for more information -;; +;; ;; http://orgmode.org/worg/org-contrib/babel/ ;;; Code: @@ -34,24 +34,25 @@ (defvar org-babel-call-process-region-original) (declare-function show-all "outline" ()) -(declare-function tramp-compat-make-temp-file "tramp" (filename &optional dir-flag)) +(declare-function tramp-compat-make-temp-file "tramp-compat" + (filename &optional dir-flag)) (declare-function tramp-dissect-file-name "tramp" (name &optional nodefault)) (declare-function tramp-file-name-user "tramp" (vec)) (declare-function tramp-file-name-host "tramp" (vec)) (declare-function org-icompleting-read "org" (&rest args)) -(declare-function org-edit-src-code "org" (context code edit-buffer-name)) +(declare-function org-edit-src-code "org-src" + (&optional context code edit-buffer-name)) (declare-function org-open-at-point "org" (&optional in-emacs reference-buffer)) (declare-function org-save-outline-visibility "org" (use-markers &rest body)) (declare-function org-narrow-to-subtree "org" ()) -(declare-function org-entry-get "org" (pom property &optional inherit)) +(declare-function org-entry-get "org" (pom property &optional inherit literal-nil)) (declare-function org-make-options-regexp "org" (kwds &optional extra)) -(declare-function org-match-string-no-properties "org" (num &optional string)) (declare-function org-do-remove-indentation "org" (&optional n)) (declare-function org-show-context "org" (&optional key)) (declare-function org-at-table-p "org" (&optional table-type)) (declare-function org-cycle "org" (&optional arg)) (declare-function org-uniquify "org" (list)) -(declare-function org-table-import "org" (file arg)) +(declare-function org-table-import "org-table" (file arg)) (declare-function org-add-hook "org-compat" (hook function &optional append local)) (declare-function org-table-align "org-table" ()) (declare-function org-table-end "org-table" (&optional table-type)) diff -r 37af1f06dafa -r 46f382b913d6 lisp/org/org-list.el --- a/lisp/org/org-list.el Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/org/org-list.el Tue Aug 17 22:47:11 2010 +0000 @@ -51,7 +51,8 @@ (declare-function org-get-indentation "org" (&optional line)) (declare-function org-timer-item "org-timer" (&optional arg)) (declare-function org-combine-plists "org" (&rest plists)) -(declare-function org-entry-get "org" (pom property &optional inherit)) +(declare-function org-entry-get "org" + (pom property &optional inherit literal-nil)) (declare-function org-narrow-to-subtree "org" ()) (declare-function org-show-subtree "org" ()) diff -r 37af1f06dafa -r 46f382b913d6 lisp/progmodes/cc-engine.el --- a/lisp/progmodes/cc-engine.el Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/progmodes/cc-engine.el Tue Aug 17 22:47:11 2010 +0000 @@ -1,8 +1,8 @@ ;;; cc-engine.el --- core syntax guessing engine for CC mode ;; Copyright (C) 1985, 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, +;; 2010 Free Software Foundation, Inc. ;; Authors: 2001- Alan Mackenzie ;; 1998- Martin Stjernholm @@ -5023,6 +5023,10 @@ (c-unmark-<->-as-paren pos)) t))) +;; Set by c-common-init in cc-mode.el. +(defvar c-new-BEG) +(defvar c-new-END) + (defun c-before-change-check-<>-operators (beg end) ;; Unmark certain pairs of "< .... >" which are currently marked as ;; template/generic delimiters. (This marking is via syntax-table @@ -5366,6 +5370,9 @@ (goto-char safe-pos) t))) +;; cc-mode requires cc-fonts. +(declare-function c-fontify-recorded-types-and-refs "cc-fonts" ()) + (defun c-forward-<>-arglist (all-types) ;; The point is assumed to be at a "<". Try to treat it as the open ;; paren of an angle bracket arglist and move forward to the diff -r 37af1f06dafa -r 46f382b913d6 lisp/progmodes/cc-mode.el --- a/lisp/progmodes/cc-mode.el Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/progmodes/cc-mode.el Tue Aug 17 22:47:11 2010 +0000 @@ -1,8 +1,8 @@ ;;; cc-mode.el --- major mode for editing C and similar languages ;; Copyright (C) 1985, 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, +;; 2010 Free Software Foundation, Inc. ;; Authors: 2003- Alan Mackenzie ;; 1998- Martin Stjernholm @@ -616,6 +616,15 @@ (font-lock-mode 0) (font-lock-mode 1))) +;; Buffer local variables defining the region to be fontified by a font lock +;; after-change function. They are set in c-after-change to +;; after-change-function's BEG and END, and may be modified by a +;; `c-before-font-lock-function'. +(defvar c-new-BEG 0) +(make-variable-buffer-local 'c-new-BEG) +(defvar c-new-END 0) +(make-variable-buffer-local 'c-new-END) + (defun c-common-init (&optional mode) "Common initialization for all CC Mode modes. In addition to the work done by `c-basic-common-init' and @@ -811,15 +820,6 @@ ;;; Change hooks, linking with Font Lock. -;; Buffer local variables defining the region to be fontified by a font lock -;; after-change function. They are set in c-after-change to -;; after-change-function's BEG and END, and may be modified by a -;; `c-before-font-lock-function'. -(defvar c-new-BEG 0) -(make-variable-buffer-local 'c-new-BEG) -(defvar c-new-END 0) -(make-variable-buffer-local 'c-new-END) - ;; Buffer local variables recording Beginning/End-of-Macro position before a ;; change, when a macro straddles, respectively, the BEG or END (or both) of ;; the change region. Otherwise these have the values BEG/END. diff -r 37af1f06dafa -r 46f382b913d6 lisp/progmodes/octave-mod.el --- a/lisp/progmodes/octave-mod.el Mon Aug 16 22:43:52 2010 +0000 +++ b/lisp/progmodes/octave-mod.el Tue Aug 17 22:47:11 2010 +0000 @@ -171,9 +171,7 @@ 'font-lock-builtin-face 'font-lock-preprocessor-face)) ;; Fontify all builtin variables. - (cons (concat "\\<\\(" - (mapconcat 'identity octave-variables "\\|") - "\\)\\>") + (cons (concat "\\<" (regexp-opt octave-variables) "\\>") 'font-lock-variable-name-face) ;; Fontify all function declarations. (list octave-function-header-regexp @@ -181,6 +179,30 @@ '(3 font-lock-function-name-face nil t))) "Additional Octave expressions to highlight.") +(defvar octave-font-lock-syntactic-keywords + ;; Try to distinguish the string-quotes from the transpose-quotes. + '(("[[({,; ]\\('\\)" (1 "\"'")) + (octave-font-lock-close-quotes))) + +(defun octave-font-lock-close-quotes (limit) + "Fix the syntax-table of the closing quotes of single-quote strings." + ;; Freely inspired from perl-font-lock-special-syntactic-constructs. + (let ((state (syntax-ppss))) + (while (< (point) limit) + (cond + ((eq (nth 3 state) ?\') + ;; A '..' string. + (save-excursion + (when (and (or (looking-at "\\('\\)") + (re-search-forward "[^\\]\\(?:\\\\\\\\\\)*\\('\\)" + nil t)) + (not (eobp))) + (put-text-property (match-beginning 1) (match-end 1) + 'syntax-table (string-to-syntax "\"'")))))) + + (setq state (parse-partial-sexp (point) limit nil nil state + 'syntax-table))))) + (defcustom inferior-octave-buffer "*Inferior Octave*" "Name of buffer for running an inferior Octave process." :type 'string @@ -195,9 +217,6 @@ (define-key map " " 'octave-electric-space) (define-key map "\n" 'octave-reindent-then-newline-and-indent) (define-key map "\e\n" 'octave-indent-new-comment-line) - (define-key map "\M-\C-a" 'octave-beginning-of-defun) - (define-key map "\M-\C-e" 'octave-end-of-defun) - (define-key map "\M-\C-h" 'octave-mark-defun) (define-key map "\M-\C-q" 'octave-indent-defun) (define-key map "\C-c\C-b" 'octave-submit-bug-report) (define-key map "\C-c\C-p" 'octave-previous-code-line) @@ -231,7 +250,9 @@ "Keymap used in Octave mode.") -(defvar octave-mode-menu + +(easy-menu-define octave-mode-menu octave-mode-map + "Menu for Octave mode." '("Octave" ("Lines" ["Previous Code Line" octave-previous-code-line t] @@ -247,9 +268,6 @@ ["Mark Block" octave-mark-block t] ["Close Block" octave-close-block t]) ("Functions" - ["Begin of Function" octave-beginning-of-defun t] - ["End of Function" octave-end-of-defun t] - ["Mark Function" octave-mark-defun t] ["Indent Function" octave-indent-defun t] ["Insert Function" octave-insert-defun t]) "-" @@ -265,14 +283,14 @@ ["Indent Line" indent-according-to-mode t] ["Complete Symbol" completion-at-point t] "-" + ;; FIXME: Make them toggle-buttons. ["Toggle Abbrev Mode" abbrev-mode t] ["Toggle Auto-Fill Mode" auto-fill-mode t] "-" ["Submit Bug Report" octave-submit-bug-report t] "-" ["Describe Octave Mode" describe-mode t] - ["Lookup Octave Index" octave-help t]) - "Menu for Octave mode.") + ["Lookup Octave Index" info-lookup-symbol t])) (defvar octave-mode-syntax-table (let ((table (make-syntax-table))) @@ -324,6 +342,7 @@ newline or semicolon after an else or end keyword." :type 'boolean :group 'octave) + (defcustom octave-block-offset 2 "Extra indentation applied to statements in Octave block structures." :type 'integer @@ -347,13 +366,13 @@ (concat octave-block-else-regexp "\\|" octave-block-end-regexp)) (defvar octave-block-match-alist '(("do" . ("until")) - ("for" . ("endfor" "end")) - ("function" . ("endfunction")) - ("if" . ("else" "elseif" "endif" "end")) - ("switch" . ("case" "otherwise" "endswitch" "end")) - ("try" . ("catch" "end_try_catch")) - ("unwind_protect" . ("unwind_protect_cleanup" "end_unwind_protect")) - ("while" . ("endwhile" "end"))) + ("for" . ("end" "endfor")) + ("function" . ("end" "endfunction")) + ("if" . ("else" "elseif" "end" "endif")) + ("switch" . ("case" "otherwise" "end" "endswitch")) + ("try" . ("catch" "end" "end_try_catch")) + ("unwind_protect" . ("unwind_protect_cleanup" "end" "end_unwind_protect")) + ("while" . ("end" "endwhile"))) "Alist with Octave's matching block keywords. Has Octave's begin keywords as keys and a list of the matching else or end keywords as associated values.") @@ -514,7 +533,9 @@ (set (make-local-variable 'normal-auto-fill-function) 'octave-auto-fill) (set (make-local-variable 'font-lock-defaults) - '(octave-font-lock-keywords nil nil)) + '(octave-font-lock-keywords nil nil nil nil + (font-lock-syntactic-keywords . octave-font-lock-syntactic-keywords) + (parse-sexp-lookup-properties . t))) (set (make-local-variable 'imenu-generic-expression) octave-mode-imenu-generic-expression) @@ -522,11 +543,15 @@ (add-hook 'completion-at-point-functions 'octave-completion-at-point-function nil t) + (set (make-local-variable 'beginning-of-defun-function) + 'octave-beginning-of-defun) - (octave-add-octave-menu) + (easy-menu-add octave-mode-menu) (octave-initialize-completions) (run-mode-hooks 'octave-mode-hook)) +(defvar info-lookup-mode) + (defun octave-help () "Get help on Octave symbols from the Octave info files. Look up symbol in the function, operator and variable indices of the info files." @@ -583,22 +608,6 @@ (let ((case-fold-search nil)) (re-search-backward regexp nil 'move count))) -(defun octave-in-defun-p () - "Return t if point is inside an Octave function declaration. -The function is taken to start at the `f' of `function' and to end after -the end keyword." - (let ((pos (point))) - (save-excursion - (or (and (octave-looking-at-kw "\\") - (octave-not-in-string-or-comment-p)) - (and (octave-beginning-of-defun) - (condition-case nil - (progn - (octave-forward-block) - t) - (error nil)) - (< pos (point))))))) - (defun octave-maybe-insert-continuation-string () (if (or (octave-in-comment-p) (save-excursion @@ -733,7 +742,7 @@ "Properly indent the Octave function which contains point." (interactive) (save-excursion - (octave-mark-defun) + (mark-defun) (message "Indenting function...") (indent-region (point) (mark) nil)) (message "Indenting function...done.")) @@ -990,16 +999,16 @@ With positive ARG, do it that many times. Negative argument -N means move forward to Nth following beginning of a function. Returns t unless search stops at the beginning or end of the buffer." - (interactive "p") (let* ((arg (or arg 1)) (inc (if (> arg 0) 1 -1)) - (found)) + (found nil) + (case-fold-search nil)) (and (not (eobp)) - (not (and (> arg 0) (octave-looking-at-kw "\\"))) + (not (and (> arg 0) (looking-at "\\"))) (skip-syntax-forward "w")) (while (and (/= arg 0) (setq found - (octave-re-search-backward-kw "\\" inc))) + (re-search-backward "\\" inc))) (if (octave-not-in-string-or-comment-p) (setq arg (- arg inc)))) (if found @@ -1007,40 +1016,6 @@ (and (< inc 0) (goto-char (match-beginning 0))) t)))) -(defun octave-end-of-defun (&optional arg) - "Move forward to the end of an Octave function. -With positive ARG, do it that many times. Negative argument -N means -move back to Nth preceding end of a function. - -An end of a function occurs right after the end keyword matching the -`function' keyword that starts the function." - (interactive "p") - (or arg (setq arg 1)) - (and (< arg 0) (skip-syntax-backward "w")) - (and (> arg 0) (skip-syntax-forward "w")) - (if (octave-in-defun-p) - (setq arg (- arg 1))) - (if (= arg 0) (setq arg -1)) - (if (octave-beginning-of-defun (- arg)) - (octave-forward-block))) - -(defun octave-mark-defun () - "Put point at the beginning of this Octave function, mark at its end. -The function marked is the one containing point or following point." - (interactive) - (let ((pos (point))) - (if (or (octave-in-defun-p) - (and (octave-beginning-of-defun -1) - (octave-in-defun-p))) - (progn - (skip-syntax-forward "w") - (octave-beginning-of-defun) - (push-mark (point)) - (octave-end-of-defun) - (exchange-point-and-mark)) - (goto-char pos) - (message "No function to mark found")))) - ;;; Filling (defun octave-auto-fill () @@ -1195,9 +1170,11 @@ (defun octave-completion-at-point-function () "Find the text to complete and the corresponding table." (let* ((beg (save-excursion (backward-sexp 1) (point))) - (end (if (< beg (point)) - (save-excursion (goto-char beg) (forward-sexp 1) (point)) - (point)))) + (end (point))) + (if (< beg (point)) + ;; Extend region past point, if applicable. + (save-excursion (goto-char beg) (forward-sexp 1) + (setq end (max end (point))))) (list beg end octave-completion-alist))) (defun octave-complete-symbol () @@ -1211,15 +1188,12 @@ (defun octave-reindent-then-newline-and-indent () "Reindent current Octave line, insert newline, and indent the new line. If Abbrev mode is on, expand abbrevs first." + ;; FIXME: None of this is Octave-specific. (interactive) (if abbrev-mode (expand-abbrev)) (if octave-blink-matching-block (octave-blink-matching-block-open)) - (save-excursion - (delete-region (point) (progn (skip-chars-backward " \t") (point))) - (indent-according-to-mode)) - (insert "\n") - (indent-according-to-mode)) + (reindent-then-newline-and-indent)) (defun octave-electric-semi () "Insert a semicolon in Octave mode. @@ -1301,15 +1275,6 @@ \n _ \n "endfunction" > \n) -;;; Menu -(defun octave-add-octave-menu () - "Add the `Octave' menu to the menu bar in Octave mode." - (require 'easymenu) - (easy-menu-define octave-mode-menu-map octave-mode-map - "Menu keymap for Octave mode." octave-mode-menu) - (easy-menu-add octave-mode-menu-map octave-mode-map)) - - ;;; Communication with the inferior Octave process (defun octave-kill-process () "Kill inferior Octave process and its buffer." @@ -1375,7 +1340,7 @@ "Send current Octave function to the inferior Octave process." (interactive) (save-excursion - (octave-mark-defun) + (mark-defun) (octave-send-region (point) (mark)))) (defun octave-send-line (&optional arg) diff -r 37af1f06dafa -r 46f382b913d6 src/ChangeLog --- a/src/ChangeLog Mon Aug 16 22:43:52 2010 +0000 +++ b/src/ChangeLog Tue Aug 17 22:47:11 2010 +0000 @@ -1,3 +1,19 @@ +2010-08-17 Stefan Monnier + + * gtkutil.c (update_frame_tool_bar): Don't assume TOOL_BAR_ITEM_LABEL + is a string. + +2010-08-17 Jan Djärv + + * nsfns.m (ns_frame_parm_handlers): Add a slot for the + x_set_tool_bar_position handler. + +2010-08-17 Eli Zaretskii + + * w32fns.c : Add a slot for the + x_set_tool_bar_position handler, needed to support changes from + 2010-07-29 (revno 100939) for positioning the tool bar. (Bug#6796) + 2010-08-16 Jan Djärv * nsselect.m: include keyboard.h for QPRIMARY, remove its @@ -30,8 +46,9 @@ 2010-08-15 Jan Djärv - * keyboard.c (parse_tool_bar_item): malloc buf. Set TOOL_BAR_ITEM_LABEL - to empty string if not set to new_lbl (Bug#6855). + * keyboard.c (parse_tool_bar_item): malloc buf. + Set TOOL_BAR_ITEM_LABEL to empty string if not set to + new_lbl (Bug#6855). 2010-08-14 Eli Zaretskii @@ -39,8 +56,8 @@ * w32term.c (x_draw_stretch_glyph_string): In R2L rows, display the cursor on the right edge of the stretch glyph. - * xdisp.c (window_box_right_offset, window_box_right): Fix - commentary. + * xdisp.c (window_box_right_offset, window_box_right): + Fix commentary. * xdisp.c (Fcurrent_bidi_paragraph_direction): Fix paragraph direction when point is inside a run of whitespace characters. diff -r 37af1f06dafa -r 46f382b913d6 src/gtkutil.c --- a/src/gtkutil.c Mon Aug 16 22:43:52 2010 +0000 +++ b/src/gtkutil.c Tue Aug 17 22:47:11 2010 +0000 @@ -4292,7 +4292,8 @@ GtkWidget *wbutton = NULL; GtkWidget *weventbox; Lisp_Object specified_file; - char *label = SSDATA (PROP (TOOL_BAR_ITEM_LABEL)); + char *label = (STRINGP (PROP (TOOL_BAR_ITEM_LABEL)) + ? SSDATA (PROP (TOOL_BAR_ITEM_LABEL)) : ""); ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i); diff -r 37af1f06dafa -r 46f382b913d6 src/nsfns.m --- a/src/nsfns.m Mon Aug 16 22:43:52 2010 +0000 +++ b/src/nsfns.m Tue Aug 17 22:47:11 2010 +0000 @@ -1041,6 +1041,7 @@ x_set_font_backend, /* generic OK */ x_set_alpha, 0, /* x_set_sticky */ + 0, /* x_set_tool_bar_position */ }; diff -r 37af1f06dafa -r 46f382b913d6 src/w32fns.c --- a/src/w32fns.c Mon Aug 16 22:43:52 2010 +0000 +++ b/src/w32fns.c Tue Aug 17 22:47:11 2010 +0000 @@ -6812,6 +6812,7 @@ x_set_font_backend, x_set_alpha, 0, /* x_set_sticky */ + 0, /* x_set_tool_bar_position */ }; void