changeset 109877:d9c31ab84005

upstream merge
author Joakim <joakim@localhost.localdomain>
date Thu, 19 Aug 2010 09:34:21 +0200
parents 224f72d9b53f (current diff) 637005c4c3ca (diff)
children 8e87a11732d4 fd080c6fcd86
files
diffstat 13 files changed, 176 insertions(+), 124 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Aug 19 09:29:27 2010 +0200
+++ b/lisp/ChangeLog	Thu Aug 19 09:34:21 2010 +0200
@@ -1,5 +1,10 @@
 2010-08-18  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* simple.el (prog-mode-map): New var.
+	(prog-indent-sexp): New command.
+
+	* progmodes/octave-mod.el (octave-mode-menu): Make toggle buttons.
+
 	* progmodes/prolog.el (smie): Require.
 
 	* emacs-lisp/smie.el (smie-default-backward-token)
--- a/lisp/emacs-lisp/smie.el	Thu Aug 19 09:29:27 2010 +0200
+++ b/lisp/emacs-lisp/smie.el	Thu Aug 19 09:34:21 2010 +0200
@@ -158,9 +158,9 @@
             (if (not (member (car shr) nts))
                 (pushnew (car shr) last-ops)
               (pushnew (car shr) last-nts)
-            (when (consp (cdr shr))
-              (assert (not (member (cadr shr) nts)))
-              (pushnew (cadr shr) last-ops)))))
+              (when (consp (cdr shr))
+                (assert (not (member (cadr shr) nts)))
+                (pushnew (cadr shr) last-ops)))))
         (push (cons nt first-ops) first-ops-table)
         (push (cons nt last-ops) last-ops-table)
         (push (cons nt first-nts) first-nts-table)
@@ -282,7 +282,7 @@
               ;; distinguish associative operators (which will have
               ;; left = right).
               (unless (caar cst)
-              (setcar (car cst) i)
+                (setcar (car cst) i)
                 (incf i))
               (setq csts (delq cst csts))))
           (unless progress
@@ -386,8 +386,8 @@
             (cond
              ((null toklevels)
               (when (zerop (length token))
-                  (condition-case err
-                      (progn (goto-char pos) (funcall next-sexp 1) nil)
+                (condition-case err
+                    (progn (goto-char pos) (funcall next-sexp 1) nil)
                   (scan-error (throw 'return
                                      (list t (caddr err)
                                            (buffer-substring-no-properties
@@ -417,10 +417,10 @@
                 (let ((lastlevels levels))
                   (if (and levels (= (funcall op-back toklevels)
                                      (funcall op-forw (car levels))))
-                    (setq levels (cdr levels)))
+                      (setq levels (cdr levels)))
                   ;; We may have found a match for the previously pending
                   ;; operator.  Is this the end?
-                (cond
+                  (cond
                    ;; Keep looking as long as we haven't matched the
                    ;; topmost operator.
                    (levels
@@ -462,11 +462,11 @@
   (t POS TOKEN): same thing but for an open-paren or the beginning of buffer.
   (nil POS TOKEN): we skipped over a paren-like pair.
   nil: we skipped over an identifier, matched parentheses, ..."
-    (smie-next-sexp
-     (indirect-function smie-backward-token-function)
-     (indirect-function 'backward-sexp)
-     (indirect-function 'smie-op-left)
-     (indirect-function 'smie-op-right)
+  (smie-next-sexp
+   (indirect-function smie-backward-token-function)
+   (indirect-function 'backward-sexp)
+   (indirect-function 'smie-op-left)
+   (indirect-function 'smie-op-right)
    halfsexp))
 
 (defun smie-forward-sexp (&optional halfsexp)
@@ -480,11 +480,11 @@
   (t POS TOKEN): same thing but for an open-paren or the beginning of buffer.
   (nil POS TOKEN): we skipped over a paren-like pair.
   nil: we skipped over an identifier, matched parentheses, ..."
-    (smie-next-sexp
-     (indirect-function smie-forward-token-function)
-     (indirect-function 'forward-sexp)
-     (indirect-function 'smie-op-right)
-     (indirect-function 'smie-op-left)
+  (smie-next-sexp
+   (indirect-function smie-forward-token-function)
+   (indirect-function 'forward-sexp)
+   (indirect-function 'smie-op-right)
+   (indirect-function 'smie-op-left)
    halfsexp))
 
 ;;; Miscellanous commands using the precedence parser.
@@ -501,14 +501,14 @@
         (forward-sexp-function nil))
     (while (/= n 0)
       (setq n (- n (if forw 1 -1)))
-        (let ((pos (point))
+      (let ((pos (point))
             (res (if forw
                      (smie-forward-sexp 'halfsexp)
                    (smie-backward-sexp 'halfsexp))))
-        (if (and (car res) (= pos (point)) (not (if forw (eolp) (bobp))))
-              (signal 'scan-error
-                      (list "Containing expression ends prematurely"
-                            (cadr res) (cadr res)))
+        (if (and (car res) (= pos (point)) (not (if forw (eobp) (bobp))))
+            (signal 'scan-error
+                    (list "Containing expression ends prematurely"
+                          (cadr res) (cadr res)))
           nil)))))
 
 (defvar smie-closer-alist nil
@@ -764,13 +764,13 @@
   ;; Obey the `fixindent' special comment.
   (and (smie-bolp)
        (save-excursion
-          (comment-normalize-vars)
-          (re-search-forward (concat comment-start-skip
-                                     "fixindent"
-                                     comment-end-skip)
-                             ;; 1+ to account for the \n comment termination.
-                             (1+ (line-end-position)) t))
-    (current-column)))
+         (comment-normalize-vars)
+         (re-search-forward (concat comment-start-skip
+                                    "fixindent"
+                                    comment-end-skip)
+                            ;; 1+ to account for the \n comment termination.
+                            (1+ (line-end-position)) t))
+       (current-column)))
 
 (defun smie-indent-bob ()
   ;; Start the file at column 0.
@@ -802,26 +802,26 @@
           (save-excursion
             (goto-char pos)
             ;; Different cases:
-          ;; - smie-bolp: "indent according to others".
-          ;; - common hanging: "indent according to others".
-          ;; - SML-let hanging: "indent like parent".
-          ;; - if-after-else: "indent-like parent".
-          ;; - middle-of-line: "trust current position".
-          (cond
-           ((null (cdr toklevels)) nil) ;Not a keyword.
-           ((smie-bolp)
-            ;; For an open-paren-like thingy at BOL, always indent only
-            ;; based on other rules (typically smie-indent-after-keyword).
-            nil)
-           (t
+            ;; - smie-bolp: "indent according to others".
+            ;; - common hanging: "indent according to others".
+            ;; - SML-let hanging: "indent like parent".
+            ;; - if-after-else: "indent-like parent".
+            ;; - middle-of-line: "trust current position".
+            (cond
+             ((null (cdr toklevels)) nil) ;Not a keyword.
+             ((smie-bolp)
+              ;; For an open-paren-like thingy at BOL, always indent only
+              ;; based on other rules (typically smie-indent-after-keyword).
+              nil)
+             (t
               ;; We're only ever here for virtual-indent, which is why
               ;; we can use (current-column) as answer for `point'.
               (let* ((tokinfo (or (assoc (cons :before token)
                                          smie-indent-rules)
-                                ;; By default use point unless we're hanging.
+                                  ;; By default use point unless we're hanging.
                                   `((:before . ,token) (:hanging nil) point)))
                      ;; (after (prog1 (point) (goto-char pos)))
-                   (offset (smie-indent-offset-rule tokinfo)))
+                     (offset (smie-indent-offset-rule tokinfo)))
                 (smie-indent-column offset)))))
 
         ;; FIXME: This still looks too much like black magic!!
@@ -896,17 +896,17 @@
                 ;; affect the indentation of the "end".
                 (current-column)
               (goto-char (cadr parent))
-            ;; Don't use (smie-indent-virtual :not-hanging) here, because we
-            ;; want to jump back over a sequence of same-level ops such as
-            ;;    a -> b -> c
-            ;;    -> d
-            ;; So as to align with the earliest appropriate place.
+              ;; Don't use (smie-indent-virtual :not-hanging) here, because we
+              ;; want to jump back over a sequence of same-level ops such as
+              ;;    a -> b -> c
+              ;;    -> d
+              ;; So as to align with the earliest appropriate place.
               (smie-indent-virtual)))
            (tokinfo
             (if (and (= (point) pos) (smie-bolp)
                      (or (eq offset 'point)
                          (and (consp offset) (memq 'point offset))))
-            ;; Since we started at BOL, we're not computing a virtual
+                ;; Since we started at BOL, we're not computing a virtual
                 ;; indentation, and we're still at the starting point, so
                 ;; we can't use `current-column' which would cause
                 ;; indentation to depend on itself.
@@ -934,12 +934,12 @@
                        (comment-string-strip comment-continue t t))))
     (and (< 0 (length continue))
          (looking-at (regexp-quote continue)) (nth 4 (syntax-ppss))
-       (let ((ppss (syntax-ppss)))
-         (save-excursion
-           (forward-line -1)
-           (if (<= (point) (nth 8 ppss))
-               (progn (goto-char (1+ (nth 8 ppss))) (current-column))
-             (skip-chars-forward " \t")
+         (let ((ppss (syntax-ppss)))
+           (save-excursion
+             (forward-line -1)
+             (if (<= (point) (nth 8 ppss))
+                 (progn (goto-char (1+ (nth 8 ppss))) (current-column))
+               (skip-chars-forward " \t")
                (if (looking-at (regexp-quote continue))
                    (current-column))))))))
 
@@ -1024,8 +1024,8 @@
 
 (defvar smie-indent-functions
   '(smie-indent-fixindent smie-indent-bob smie-indent-close smie-indent-comment
-    smie-indent-comment-continue smie-indent-keyword smie-indent-after-keyword
-    smie-indent-exps)
+   smie-indent-comment-continue smie-indent-keyword smie-indent-after-keyword
+   smie-indent-exps)
   "Functions to compute the indentation.
 Each function is called with no argument, shouldn't move point, and should
 return either nil if it has no opinion, or an integer representing the column
--- a/lisp/org/ChangeLog	Thu Aug 19 09:29:27 2010 +0200
+++ b/lisp/org/ChangeLog	Thu Aug 19 09:34:21 2010 +0200
@@ -1,3 +1,12 @@
+2010-08-19  Glenn Morris  <rgm@gnu.org>
+
+	* org.el (org-outline-overlay-data, org-set-outline-overlay-data)
+	(org-save-outline-visibility): Move to org-macs.
+	* org-macs.el (org-outline-overlay-data, org-set-outline-overlay-data)
+	(org-save-outline-visibility): Move here from org.el.
+	(show-all): Autoload it.
+	* ob.el: Don't require org when compiling.
+
 2010-08-18  Glenn Morris  <rgm@gnu.org>
 
 	* ob.el: Require org when compiling.
--- a/lisp/org/ob.el	Thu Aug 19 09:29:27 2010 +0200
+++ b/lisp/org/ob.el	Thu Aug 19 09:34:21 2010 +0200
@@ -30,8 +30,7 @@
 
 ;;; Code:
 (eval-when-compile
-  (require 'cl)
-  (require 'org))                  ; org-save-outline-visibility macro
+  (require 'cl))
 (require 'org-macs)
 
 (defvar org-babel-call-process-region-original)
--- a/lisp/org/org-macs.el	Thu Aug 19 09:29:27 2010 +0200
+++ b/lisp/org/org-macs.el	Thu Aug 19 09:34:21 2010 +0200
@@ -300,6 +300,66 @@
 	   (nstars (if org-odd-levels-only (1- (* limit-level 2)) limit-level)))
       (format "\\*\\{1,%d\\} " nstars))))
 
+
+;;; Saving and restoring visibility
+
+(defun org-outline-overlay-data (&optional use-markers)
+  "Return a list of the locations of all outline overlays.
+The are overlays with the `invisible' property value `outline'.
+The return values is a list of cons cells, with start and stop
+positions for each overlay.
+If USE-MARKERS is set, return the positions as markers."
+  (let (beg end)
+    (save-excursion
+      (save-restriction
+	(widen)
+	(delq nil
+	      (mapcar (lambda (o)
+			(when (eq (overlay-get o 'invisible) 'outline)
+			  (setq beg (overlay-start o)
+				end (overlay-end o))
+			  (and beg end (> end beg)
+			       (if use-markers
+				   (cons (move-marker (make-marker) beg)
+					 (move-marker (make-marker) end))
+				 (cons beg end)))))
+		      (overlays-in (point-min) (point-max))))))))
+
+(autoload 'show-all "outline" nil t)
+
+(defun org-set-outline-overlay-data (data)
+  "Create visibility overlays for all positions in DATA.
+DATA should have been made by `org-outline-overlay-data'."
+  (let (o)
+    (save-excursion
+      (save-restriction
+	(widen)
+	(show-all)
+	(mapc (lambda (c)
+		(setq o (make-overlay (car c) (cdr c)))
+		(overlay-put o 'invisible 'outline))
+	      data)))))
+
+(defmacro org-save-outline-visibility (use-markers &rest body)
+  "Save and restore outline visibility around BODY.
+If USE-MARKERS is non-nil, use markers for the positions.
+This means that the buffer may change while running BODY,
+but it also means that the buffer should stay alive
+during the operation, because otherwise all these markers will
+point nowhere."
+  (declare (indent 1))
+  `(let ((data (org-outline-overlay-data ,use-markers)))
+     (unwind-protect
+	 (progn
+	   ,@body
+	   (org-set-outline-overlay-data data))
+       (when ,use-markers
+	 (mapc (lambda (c)
+		 (and (markerp (car c)) (move-marker (car c) nil))
+		 (and (markerp (cdr c)) (move-marker (cdr c) nil)))
+	       data)))))
+
+
 (provide 'org-macs)
 
 ;; arch-tag: 7e6a73ce-aac9-4fc0-9b30-ce6f89dc6668
--- a/lisp/org/org.el	Thu Aug 19 09:29:27 2010 +0200
+++ b/lisp/org/org.el	Thu Aug 19 09:34:21 2010 +0200
@@ -6190,62 +6190,6 @@
     (beginning-of-line)
     (recenter (prefix-numeric-value N))))
 
-;;; Saving and restoring visibility
-
-(defun org-outline-overlay-data (&optional use-markers)
-  "Return a list of the locations of all outline overlays.
-The are overlays with the `invisible' property value `outline'.
-The return values is a list of cons cells, with start and stop
-positions for each overlay.
-If USE-MARKERS is set, return the positions as markers."
-  (let (beg end)
-    (save-excursion
-      (save-restriction
-	(widen)
-	(delq nil
-	      (mapcar (lambda (o)
-			(when (eq (overlay-get o 'invisible) 'outline)
-			  (setq beg (overlay-start o)
-				end (overlay-end o))
-			  (and beg end (> end beg)
-			       (if use-markers
-				   (cons (move-marker (make-marker) beg)
-					 (move-marker (make-marker) end))
-				 (cons beg end)))))
-		      (overlays-in (point-min) (point-max))))))))
-
-(defun org-set-outline-overlay-data (data)
-  "Create visibility overlays for all positions in DATA.
-DATA should have been made by `org-outline-overlay-data'."
-  (let (o)
-    (save-excursion
-      (save-restriction
-	(widen)
-	(show-all)
-	(mapc (lambda (c)
-		(setq o (make-overlay (car c) (cdr c)))
-		(overlay-put o 'invisible 'outline))
-	      data)))))
-
-(defmacro org-save-outline-visibility (use-markers &rest body)
-  "Save and restore outline visibility around BODY.
-If USE-MARKERS is non-nil, use markers for the positions.
-This means that the buffer may change while running BODY,
-but it also means that the buffer should stay alive
-during the operation, because otherwise all these markers will
-point nowhere."
-  (declare (indent 1))
-  `(let ((data (org-outline-overlay-data ,use-markers)))
-     (unwind-protect
-	 (progn
-	   ,@body
-	   (org-set-outline-overlay-data data))
-       (when ,use-markers
-	 (mapc (lambda (c)
-		 (and (markerp (car c)) (move-marker (car c) nil))
-		 (and (markerp (cdr c)) (move-marker (cdr c) nil)))
-	       data)))))
-
 
 ;;; Folding of blocks
 
--- a/lisp/progmodes/octave-mod.el	Thu Aug 19 09:29:27 2010 +0200
+++ b/lisp/progmodes/octave-mod.el	Thu Aug 19 09:34:21 2010 +0200
@@ -283,9 +283,10 @@
     ["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]
+    ["Toggle Abbrev Mode"	abbrev-mode
+     :style toggle :selected abbrev-mode]
+    ["Toggle Auto-Fill Mode"	auto-fill-mode
+     :style toggle :selected auto-fill-function]
     "-"
     ["Submit Bug Report"	octave-submit-bug-report t]
     "-"
--- a/lisp/simple.el	Thu Aug 19 09:29:27 2010 +0200
+++ b/lisp/simple.el	Thu Aug 19 09:34:21 2010 +0200
@@ -424,6 +424,19 @@
 
 ;; Major mode meant to be the parent of programming modes.
 
+(defvar prog-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [?\C-\M-q] 'prog-indent-sexp)
+    map)
+  "Keymap used for programming modes.")
+
+(defun prog-indent-sexp ()
+  "Indent the expression after point."
+  (interactive)
+  (let ((start (point))
+        (end (save-excursion (forward-sexp 1) (point))))
+    (indent-region start end nil)))
+
 (define-derived-mode prog-mode fundamental-mode "Prog"
   "Major mode for editing programming language source code."
   (set (make-local-variable 'require-final-newline) mode-require-final-newline)
--- a/src/ChangeLog	Thu Aug 19 09:29:27 2010 +0200
+++ b/src/ChangeLog	Thu Aug 19 09:34:21 2010 +0200
@@ -1,3 +1,13 @@
+2010-08-19  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* nsselect.m (nxatoms_of_nsselect): Use "Selection" and "Secondary".
+
+2010-08-18  Eli Zaretskii  <eliz@gnu.org>
+
+	* xterm.c (x_draw_bar_cursor):
+	* w32term.c (x_draw_bar_cursor): If the character under cursor is
+	R2L, draw the bar cursor on its right rather than on its left.
+
 2010-08-18  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* eval.c (Fdefmacro): Only obey one declaration.
--- a/src/bidi.c	Thu Aug 19 09:29:27 2010 +0200
+++ b/src/bidi.c	Thu Aug 19 09:34:21 2010 +0200
@@ -1533,7 +1533,7 @@
 
 	 we want it to be displayed as
 
-	     {RLO}STet{PDF}
+	     {PDF}STet{RLO}
 
 	 not as
 
--- a/src/nsselect.m	Thu Aug 19 09:29:27 2010 +0200
+++ b/src/nsselect.m	Thu Aug 19 09:34:21 2010 +0200
@@ -542,8 +542,8 @@
 void
 nxatoms_of_nsselect (void)
 {
-  NXPrimaryPboard = @"PrimarySelection";
-  NXSecondaryPboard = @"SecondarySelection";
+  NXPrimaryPboard = @"Selection";
+  NXSecondaryPboard = @"Secondary";
 }
 
 void
--- a/src/w32term.c	Thu Aug 19 09:29:27 2010 +0200
+++ b/src/w32term.c	Thu Aug 19 09:34:21 2010 +0200
@@ -4897,6 +4897,11 @@
 
 	  w->phys_cursor_width = width;
 
+	  /* If the character under cursor is R2L, draw the bar cursor
+	     on the right of its glyph, rather than on the left.  */
+	  if ((cursor_glyph->resolved_level & 1) != 0)
+	    x += cursor_glyph->pixel_width - width;
+
 	  w32_fill_area (f, hdc, cursor_color, x,
 			 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
 			 width, row->height);
--- a/src/xterm.c	Thu Aug 19 09:29:27 2010 +0200
+++ b/src/xterm.c	Thu Aug 19 09:34:21 2010 +0200
@@ -7152,14 +7152,20 @@
 
       if (kind == BAR_CURSOR)
 	{
+	  int x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
+
 	  if (width < 0)
 	    width = FRAME_CURSOR_WIDTH (f);
 	  width = min (cursor_glyph->pixel_width, width);
 
 	  w->phys_cursor_width = width;
 
-	  XFillRectangle (dpy, window, gc,
-			  WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x),
+	  /* If the character under cursor is R2L, draw the bar cursor
+	     on the right of its glyph, rather than on the left.  */
+	  if ((cursor_glyph->resolved_level & 1) != 0)
+	    x += cursor_glyph->pixel_width - width;
+
+	  XFillRectangle (dpy, window, gc, x,
 			  WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
 			  width, row->height);
 	}