aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2010-08-19 09:34:21 +0200
committerJoakim Verona2010-08-19 09:34:21 +0200
commit96fa1768839e3a9aa5ab5f2b782cea376460df9d (patch)
treef4c2fc0e8bb15dd084aa10bb8b2fb7ab43630cdf
parent549a73b97bce9fe51547332424e0a6cb7070df1a (diff)
parent2c0ac86767b5b7f362a287b5282d8397777b98a2 (diff)
downloademacs-96fa1768839e3a9aa5ab5f2b782cea376460df9d.tar.gz
emacs-96fa1768839e3a9aa5ab5f2b782cea376460df9d.zip
upstream merge
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/emacs-lisp/smie.el116
-rw-r--r--lisp/org/ChangeLog9
-rw-r--r--lisp/org/ob.el3
-rw-r--r--lisp/org/org-macs.el60
-rw-r--r--lisp/org/org.el56
-rw-r--r--lisp/progmodes/octave-mod.el7
-rw-r--r--lisp/simple.el13
-rw-r--r--src/ChangeLog10
-rw-r--r--src/bidi.c2
-rw-r--r--src/nsselect.m4
-rw-r--r--src/w32term.c5
-rw-r--r--src/xterm.c10
13 files changed, 176 insertions, 124 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 85d7dda3395..ce5baa1b1a1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
12010-08-18 Stefan Monnier <monnier@iro.umontreal.ca> 12010-08-18 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * simple.el (prog-mode-map): New var.
4 (prog-indent-sexp): New command.
5
6 * progmodes/octave-mod.el (octave-mode-menu): Make toggle buttons.
7
3 * progmodes/prolog.el (smie): Require. 8 * progmodes/prolog.el (smie): Require.
4 9
5 * emacs-lisp/smie.el (smie-default-backward-token) 10 * emacs-lisp/smie.el (smie-default-backward-token)
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index cb8e8fd9843..2fbf0628dbe 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -158,9 +158,9 @@ one of those elements share the same precedence level and associativity."
158 (if (not (member (car shr) nts)) 158 (if (not (member (car shr) nts))
159 (pushnew (car shr) last-ops) 159 (pushnew (car shr) last-ops)
160 (pushnew (car shr) last-nts) 160 (pushnew (car shr) last-nts)
161 (when (consp (cdr shr)) 161 (when (consp (cdr shr))
162 (assert (not (member (cadr shr) nts))) 162 (assert (not (member (cadr shr) nts)))
163 (pushnew (cadr shr) last-ops))))) 163 (pushnew (cadr shr) last-ops)))))
164 (push (cons nt first-ops) first-ops-table) 164 (push (cons nt first-ops) first-ops-table)
165 (push (cons nt last-ops) last-ops-table) 165 (push (cons nt last-ops) last-ops-table)
166 (push (cons nt first-nts) first-nts-table) 166 (push (cons nt first-nts) first-nts-table)
@@ -282,7 +282,7 @@ PREC2 is a table as returned by `smie-precs-precedence-table' or
282 ;; distinguish associative operators (which will have 282 ;; distinguish associative operators (which will have
283 ;; left = right). 283 ;; left = right).
284 (unless (caar cst) 284 (unless (caar cst)
285 (setcar (car cst) i) 285 (setcar (car cst) i)
286 (incf i)) 286 (incf i))
287 (setq csts (delq cst csts)))) 287 (setq csts (delq cst csts))))
288 (unless progress 288 (unless progress
@@ -386,8 +386,8 @@ Possible return values:
386 (cond 386 (cond
387 ((null toklevels) 387 ((null toklevels)
388 (when (zerop (length token)) 388 (when (zerop (length token))
389 (condition-case err 389 (condition-case err
390 (progn (goto-char pos) (funcall next-sexp 1) nil) 390 (progn (goto-char pos) (funcall next-sexp 1) nil)
391 (scan-error (throw 'return 391 (scan-error (throw 'return
392 (list t (caddr err) 392 (list t (caddr err)
393 (buffer-substring-no-properties 393 (buffer-substring-no-properties
@@ -417,10 +417,10 @@ Possible return values:
417 (let ((lastlevels levels)) 417 (let ((lastlevels levels))
418 (if (and levels (= (funcall op-back toklevels) 418 (if (and levels (= (funcall op-back toklevels)
419 (funcall op-forw (car levels)))) 419 (funcall op-forw (car levels))))
420 (setq levels (cdr levels))) 420 (setq levels (cdr levels)))
421 ;; We may have found a match for the previously pending 421 ;; We may have found a match for the previously pending
422 ;; operator. Is this the end? 422 ;; operator. Is this the end?
423 (cond 423 (cond
424 ;; Keep looking as long as we haven't matched the 424 ;; Keep looking as long as we haven't matched the
425 ;; topmost operator. 425 ;; topmost operator.
426 (levels 426 (levels
@@ -462,11 +462,11 @@ Possible return values:
462 (t POS TOKEN): same thing but for an open-paren or the beginning of buffer. 462 (t POS TOKEN): same thing but for an open-paren or the beginning of buffer.
463 (nil POS TOKEN): we skipped over a paren-like pair. 463 (nil POS TOKEN): we skipped over a paren-like pair.
464 nil: we skipped over an identifier, matched parentheses, ..." 464 nil: we skipped over an identifier, matched parentheses, ..."
465 (smie-next-sexp 465 (smie-next-sexp
466 (indirect-function smie-backward-token-function) 466 (indirect-function smie-backward-token-function)
467 (indirect-function 'backward-sexp) 467 (indirect-function 'backward-sexp)
468 (indirect-function 'smie-op-left) 468 (indirect-function 'smie-op-left)
469 (indirect-function 'smie-op-right) 469 (indirect-function 'smie-op-right)
470 halfsexp)) 470 halfsexp))
471 471
472(defun smie-forward-sexp (&optional halfsexp) 472(defun smie-forward-sexp (&optional halfsexp)
@@ -480,11 +480,11 @@ Possible return values:
480 (t POS TOKEN): same thing but for an open-paren or the beginning of buffer. 480 (t POS TOKEN): same thing but for an open-paren or the beginning of buffer.
481 (nil POS TOKEN): we skipped over a paren-like pair. 481 (nil POS TOKEN): we skipped over a paren-like pair.
482 nil: we skipped over an identifier, matched parentheses, ..." 482 nil: we skipped over an identifier, matched parentheses, ..."
483 (smie-next-sexp 483 (smie-next-sexp
484 (indirect-function smie-forward-token-function) 484 (indirect-function smie-forward-token-function)
485 (indirect-function 'forward-sexp) 485 (indirect-function 'forward-sexp)
486 (indirect-function 'smie-op-right) 486 (indirect-function 'smie-op-right)
487 (indirect-function 'smie-op-left) 487 (indirect-function 'smie-op-left)
488 halfsexp)) 488 halfsexp))
489 489
490;;; Miscellanous commands using the precedence parser. 490;;; Miscellanous commands using the precedence parser.
@@ -501,14 +501,14 @@ Possible return values:
501 (forward-sexp-function nil)) 501 (forward-sexp-function nil))
502 (while (/= n 0) 502 (while (/= n 0)
503 (setq n (- n (if forw 1 -1))) 503 (setq n (- n (if forw 1 -1)))
504 (let ((pos (point)) 504 (let ((pos (point))
505 (res (if forw 505 (res (if forw
506 (smie-forward-sexp 'halfsexp) 506 (smie-forward-sexp 'halfsexp)
507 (smie-backward-sexp 'halfsexp)))) 507 (smie-backward-sexp 'halfsexp))))
508 (if (and (car res) (= pos (point)) (not (if forw (eolp) (bobp)))) 508 (if (and (car res) (= pos (point)) (not (if forw (eobp) (bobp))))
509 (signal 'scan-error 509 (signal 'scan-error
510 (list "Containing expression ends prematurely" 510 (list "Containing expression ends prematurely"
511 (cadr res) (cadr res))) 511 (cadr res) (cadr res)))
512 nil))))) 512 nil)))))
513 513
514(defvar smie-closer-alist nil 514(defvar smie-closer-alist nil
@@ -764,13 +764,13 @@ in order to figure out the indentation of some other (further down) point."
764 ;; Obey the `fixindent' special comment. 764 ;; Obey the `fixindent' special comment.
765 (and (smie-bolp) 765 (and (smie-bolp)
766 (save-excursion 766 (save-excursion
767 (comment-normalize-vars) 767 (comment-normalize-vars)
768 (re-search-forward (concat comment-start-skip 768 (re-search-forward (concat comment-start-skip
769 "fixindent" 769 "fixindent"
770 comment-end-skip) 770 comment-end-skip)
771 ;; 1+ to account for the \n comment termination. 771 ;; 1+ to account for the \n comment termination.
772 (1+ (line-end-position)) t)) 772 (1+ (line-end-position)) t))
773 (current-column))) 773 (current-column)))
774 774
775(defun smie-indent-bob () 775(defun smie-indent-bob ()
776 ;; Start the file at column 0. 776 ;; Start the file at column 0.
@@ -802,26 +802,26 @@ in order to figure out the indentation of some other (further down) point."
802 (save-excursion 802 (save-excursion
803 (goto-char pos) 803 (goto-char pos)
804 ;; Different cases: 804 ;; Different cases:
805 ;; - smie-bolp: "indent according to others". 805 ;; - smie-bolp: "indent according to others".
806 ;; - common hanging: "indent according to others". 806 ;; - common hanging: "indent according to others".
807 ;; - SML-let hanging: "indent like parent". 807 ;; - SML-let hanging: "indent like parent".
808 ;; - if-after-else: "indent-like parent". 808 ;; - if-after-else: "indent-like parent".
809 ;; - middle-of-line: "trust current position". 809 ;; - middle-of-line: "trust current position".
810 (cond 810 (cond
811 ((null (cdr toklevels)) nil) ;Not a keyword. 811 ((null (cdr toklevels)) nil) ;Not a keyword.
812 ((smie-bolp) 812 ((smie-bolp)
813 ;; For an open-paren-like thingy at BOL, always indent only 813 ;; For an open-paren-like thingy at BOL, always indent only
814 ;; based on other rules (typically smie-indent-after-keyword). 814 ;; based on other rules (typically smie-indent-after-keyword).
815 nil) 815 nil)
816 (t 816 (t
817 ;; We're only ever here for virtual-indent, which is why 817 ;; We're only ever here for virtual-indent, which is why
818 ;; we can use (current-column) as answer for `point'. 818 ;; we can use (current-column) as answer for `point'.
819 (let* ((tokinfo (or (assoc (cons :before token) 819 (let* ((tokinfo (or (assoc (cons :before token)
820 smie-indent-rules) 820 smie-indent-rules)
821 ;; By default use point unless we're hanging. 821 ;; By default use point unless we're hanging.
822 `((:before . ,token) (:hanging nil) point))) 822 `((:before . ,token) (:hanging nil) point)))
823 ;; (after (prog1 (point) (goto-char pos))) 823 ;; (after (prog1 (point) (goto-char pos)))
824 (offset (smie-indent-offset-rule tokinfo))) 824 (offset (smie-indent-offset-rule tokinfo)))
825 (smie-indent-column offset))))) 825 (smie-indent-column offset)))))
826 826
827 ;; FIXME: This still looks too much like black magic!! 827 ;; FIXME: This still looks too much like black magic!!
@@ -896,17 +896,17 @@ in order to figure out the indentation of some other (further down) point."
896 ;; affect the indentation of the "end". 896 ;; affect the indentation of the "end".
897 (current-column) 897 (current-column)
898 (goto-char (cadr parent)) 898 (goto-char (cadr parent))
899 ;; Don't use (smie-indent-virtual :not-hanging) here, because we 899 ;; Don't use (smie-indent-virtual :not-hanging) here, because we
900 ;; want to jump back over a sequence of same-level ops such as 900 ;; want to jump back over a sequence of same-level ops such as
901 ;; a -> b -> c 901 ;; a -> b -> c
902 ;; -> d 902 ;; -> d
903 ;; So as to align with the earliest appropriate place. 903 ;; So as to align with the earliest appropriate place.
904 (smie-indent-virtual))) 904 (smie-indent-virtual)))
905 (tokinfo 905 (tokinfo
906 (if (and (= (point) pos) (smie-bolp) 906 (if (and (= (point) pos) (smie-bolp)
907 (or (eq offset 'point) 907 (or (eq offset 'point)
908 (and (consp offset) (memq 'point offset)))) 908 (and (consp offset) (memq 'point offset))))
909 ;; Since we started at BOL, we're not computing a virtual 909 ;; Since we started at BOL, we're not computing a virtual
910 ;; indentation, and we're still at the starting point, so 910 ;; indentation, and we're still at the starting point, so
911 ;; we can't use `current-column' which would cause 911 ;; we can't use `current-column' which would cause
912 ;; indentation to depend on itself. 912 ;; indentation to depend on itself.
@@ -934,12 +934,12 @@ in order to figure out the indentation of some other (further down) point."
934 (comment-string-strip comment-continue t t)))) 934 (comment-string-strip comment-continue t t))))
935 (and (< 0 (length continue)) 935 (and (< 0 (length continue))
936 (looking-at (regexp-quote continue)) (nth 4 (syntax-ppss)) 936 (looking-at (regexp-quote continue)) (nth 4 (syntax-ppss))
937 (let ((ppss (syntax-ppss))) 937 (let ((ppss (syntax-ppss)))
938 (save-excursion 938 (save-excursion
939 (forward-line -1) 939 (forward-line -1)
940 (if (<= (point) (nth 8 ppss)) 940 (if (<= (point) (nth 8 ppss))
941 (progn (goto-char (1+ (nth 8 ppss))) (current-column)) 941 (progn (goto-char (1+ (nth 8 ppss))) (current-column))
942 (skip-chars-forward " \t") 942 (skip-chars-forward " \t")
943 (if (looking-at (regexp-quote continue)) 943 (if (looking-at (regexp-quote continue))
944 (current-column)))))))) 944 (current-column))))))))
945 945
@@ -1024,8 +1024,8 @@ in order to figure out the indentation of some other (further down) point."
1024 1024
1025(defvar smie-indent-functions 1025(defvar smie-indent-functions
1026 '(smie-indent-fixindent smie-indent-bob smie-indent-close smie-indent-comment 1026 '(smie-indent-fixindent smie-indent-bob smie-indent-close smie-indent-comment
1027 smie-indent-comment-continue smie-indent-keyword smie-indent-after-keyword 1027 smie-indent-comment-continue smie-indent-keyword smie-indent-after-keyword
1028 smie-indent-exps) 1028 smie-indent-exps)
1029 "Functions to compute the indentation. 1029 "Functions to compute the indentation.
1030Each function is called with no argument, shouldn't move point, and should 1030Each function is called with no argument, shouldn't move point, and should
1031return either nil if it has no opinion, or an integer representing the column 1031return either nil if it has no opinion, or an integer representing the column
diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog
index 5b650492442..c0b3fa567c6 100644
--- a/lisp/org/ChangeLog
+++ b/lisp/org/ChangeLog
@@ -1,3 +1,12 @@
12010-08-19 Glenn Morris <rgm@gnu.org>
2
3 * org.el (org-outline-overlay-data, org-set-outline-overlay-data)
4 (org-save-outline-visibility): Move to org-macs.
5 * org-macs.el (org-outline-overlay-data, org-set-outline-overlay-data)
6 (org-save-outline-visibility): Move here from org.el.
7 (show-all): Autoload it.
8 * ob.el: Don't require org when compiling.
9
12010-08-18 Glenn Morris <rgm@gnu.org> 102010-08-18 Glenn Morris <rgm@gnu.org>
2 11
3 * ob.el: Require org when compiling. 12 * ob.el: Require org when compiling.
diff --git a/lisp/org/ob.el b/lisp/org/ob.el
index 4ae3e4f662c..a58fb4eca8a 100644
--- a/lisp/org/ob.el
+++ b/lisp/org/ob.el
@@ -30,8 +30,7 @@
30 30
31;;; Code: 31;;; Code:
32(eval-when-compile 32(eval-when-compile
33 (require 'cl) 33 (require 'cl))
34 (require 'org)) ; org-save-outline-visibility macro
35(require 'org-macs) 34(require 'org-macs)
36 35
37(defvar org-babel-call-process-region-original) 36(defvar org-babel-call-process-region-original)
diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el
index abcdcdc94eb..212fae4fcc9 100644
--- a/lisp/org/org-macs.el
+++ b/lisp/org/org-macs.el
@@ -300,6 +300,66 @@ The number of levels is controlled by `org-inlinetask-min-level'"
300 (nstars (if org-odd-levels-only (1- (* limit-level 2)) limit-level))) 300 (nstars (if org-odd-levels-only (1- (* limit-level 2)) limit-level)))
301 (format "\\*\\{1,%d\\} " nstars)))) 301 (format "\\*\\{1,%d\\} " nstars))))
302 302
303
304;;; Saving and restoring visibility
305
306(defun org-outline-overlay-data (&optional use-markers)
307 "Return a list of the locations of all outline overlays.
308The are overlays with the `invisible' property value `outline'.
309The return values is a list of cons cells, with start and stop
310positions for each overlay.
311If USE-MARKERS is set, return the positions as markers."
312 (let (beg end)
313 (save-excursion
314 (save-restriction
315 (widen)
316 (delq nil
317 (mapcar (lambda (o)
318 (when (eq (overlay-get o 'invisible) 'outline)
319 (setq beg (overlay-start o)
320 end (overlay-end o))
321 (and beg end (> end beg)
322 (if use-markers
323 (cons (move-marker (make-marker) beg)
324 (move-marker (make-marker) end))
325 (cons beg end)))))
326 (overlays-in (point-min) (point-max))))))))
327
328(autoload 'show-all "outline" nil t)
329
330(defun org-set-outline-overlay-data (data)
331 "Create visibility overlays for all positions in DATA.
332DATA should have been made by `org-outline-overlay-data'."
333 (let (o)
334 (save-excursion
335 (save-restriction
336 (widen)
337 (show-all)
338 (mapc (lambda (c)
339 (setq o (make-overlay (car c) (cdr c)))
340 (overlay-put o 'invisible 'outline))
341 data)))))
342
343(defmacro org-save-outline-visibility (use-markers &rest body)
344 "Save and restore outline visibility around BODY.
345If USE-MARKERS is non-nil, use markers for the positions.
346This means that the buffer may change while running BODY,
347but it also means that the buffer should stay alive
348during the operation, because otherwise all these markers will
349point nowhere."
350 (declare (indent 1))
351 `(let ((data (org-outline-overlay-data ,use-markers)))
352 (unwind-protect
353 (progn
354 ,@body
355 (org-set-outline-overlay-data data))
356 (when ,use-markers
357 (mapc (lambda (c)
358 (and (markerp (car c)) (move-marker (car c) nil))
359 (and (markerp (cdr c)) (move-marker (cdr c) nil)))
360 data)))))
361
362
303(provide 'org-macs) 363(provide 'org-macs)
304 364
305;; arch-tag: 7e6a73ce-aac9-4fc0-9b30-ce6f89dc6668 365;; arch-tag: 7e6a73ce-aac9-4fc0-9b30-ce6f89dc6668
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 5b37e0aa260..a2965e87d22 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -6190,62 +6190,6 @@ Optional argument N means put the headline into the Nth line of the window."
6190 (beginning-of-line) 6190 (beginning-of-line)
6191 (recenter (prefix-numeric-value N)))) 6191 (recenter (prefix-numeric-value N))))
6192 6192
6193;;; Saving and restoring visibility
6194
6195(defun org-outline-overlay-data (&optional use-markers)
6196 "Return a list of the locations of all outline overlays.
6197The are overlays with the `invisible' property value `outline'.
6198The return values is a list of cons cells, with start and stop
6199positions for each overlay.
6200If USE-MARKERS is set, return the positions as markers."
6201 (let (beg end)
6202 (save-excursion
6203 (save-restriction
6204 (widen)
6205 (delq nil
6206 (mapcar (lambda (o)
6207 (when (eq (overlay-get o 'invisible) 'outline)
6208 (setq beg (overlay-start o)
6209 end (overlay-end o))
6210 (and beg end (> end beg)
6211 (if use-markers
6212 (cons (move-marker (make-marker) beg)
6213 (move-marker (make-marker) end))
6214 (cons beg end)))))
6215 (overlays-in (point-min) (point-max))))))))
6216
6217(defun org-set-outline-overlay-data (data)
6218 "Create visibility overlays for all positions in DATA.
6219DATA should have been made by `org-outline-overlay-data'."
6220 (let (o)
6221 (save-excursion
6222 (save-restriction
6223 (widen)
6224 (show-all)
6225 (mapc (lambda (c)
6226 (setq o (make-overlay (car c) (cdr c)))
6227 (overlay-put o 'invisible 'outline))
6228 data)))))
6229
6230(defmacro org-save-outline-visibility (use-markers &rest body)
6231 "Save and restore outline visibility around BODY.
6232If USE-MARKERS is non-nil, use markers for the positions.
6233This means that the buffer may change while running BODY,
6234but it also means that the buffer should stay alive
6235during the operation, because otherwise all these markers will
6236point nowhere."
6237 (declare (indent 1))
6238 `(let ((data (org-outline-overlay-data ,use-markers)))
6239 (unwind-protect
6240 (progn
6241 ,@body
6242 (org-set-outline-overlay-data data))
6243 (when ,use-markers
6244 (mapc (lambda (c)
6245 (and (markerp (car c)) (move-marker (car c) nil))
6246 (and (markerp (cdr c)) (move-marker (cdr c) nil)))
6247 data)))))
6248
6249 6193
6250;;; Folding of blocks 6194;;; Folding of blocks
6251 6195
diff --git a/lisp/progmodes/octave-mod.el b/lisp/progmodes/octave-mod.el
index 382b817e80f..11d86ecbde4 100644
--- a/lisp/progmodes/octave-mod.el
+++ b/lisp/progmodes/octave-mod.el
@@ -283,9 +283,10 @@ parenthetical grouping.")
283 ["Indent Line" indent-according-to-mode t] 283 ["Indent Line" indent-according-to-mode t]
284 ["Complete Symbol" completion-at-point t] 284 ["Complete Symbol" completion-at-point t]
285 "-" 285 "-"
286 ;; FIXME: Make them toggle-buttons. 286 ["Toggle Abbrev Mode" abbrev-mode
287 ["Toggle Abbrev Mode" abbrev-mode t] 287 :style toggle :selected abbrev-mode]
288 ["Toggle Auto-Fill Mode" auto-fill-mode t] 288 ["Toggle Auto-Fill Mode" auto-fill-mode
289 :style toggle :selected auto-fill-function]
289 "-" 290 "-"
290 ["Submit Bug Report" octave-submit-bug-report t] 291 ["Submit Bug Report" octave-submit-bug-report t]
291 "-" 292 "-"
diff --git a/lisp/simple.el b/lisp/simple.el
index 5a2c9e70ad6..7c941fd63b9 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -424,6 +424,19 @@ Other major modes are defined by comparison with this one."
424 424
425;; Major mode meant to be the parent of programming modes. 425;; Major mode meant to be the parent of programming modes.
426 426
427(defvar prog-mode-map
428 (let ((map (make-sparse-keymap)))
429 (define-key map [?\C-\M-q] 'prog-indent-sexp)
430 map)
431 "Keymap used for programming modes.")
432
433(defun prog-indent-sexp ()
434 "Indent the expression after point."
435 (interactive)
436 (let ((start (point))
437 (end (save-excursion (forward-sexp 1) (point))))
438 (indent-region start end nil)))
439
427(define-derived-mode prog-mode fundamental-mode "Prog" 440(define-derived-mode prog-mode fundamental-mode "Prog"
428 "Major mode for editing programming language source code." 441 "Major mode for editing programming language source code."
429 (set (make-local-variable 'require-final-newline) mode-require-final-newline) 442 (set (make-local-variable 'require-final-newline) mode-require-final-newline)
diff --git a/src/ChangeLog b/src/ChangeLog
index 45cccea1ebb..0a1a268d962 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12010-08-19 Jan Djärv <jan.h.d@swipnet.se>
2
3 * nsselect.m (nxatoms_of_nsselect): Use "Selection" and "Secondary".
4
52010-08-18 Eli Zaretskii <eliz@gnu.org>
6
7 * xterm.c (x_draw_bar_cursor):
8 * w32term.c (x_draw_bar_cursor): If the character under cursor is
9 R2L, draw the bar cursor on its right rather than on its left.
10
12010-08-18 Stefan Monnier <monnier@iro.umontreal.ca> 112010-08-18 Stefan Monnier <monnier@iro.umontreal.ca>
2 12
3 * eval.c (Fdefmacro): Only obey one declaration. 13 * eval.c (Fdefmacro): Only obey one declaration.
diff --git a/src/bidi.c b/src/bidi.c
index 112d9b08b23..a6d4d1b2506 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -1533,7 +1533,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
1533 1533
1534 we want it to be displayed as 1534 we want it to be displayed as
1535 1535
1536 {RLO}STet{PDF} 1536 {PDF}STet{RLO}
1537 1537
1538 not as 1538 not as
1539 1539
diff --git a/src/nsselect.m b/src/nsselect.m
index 597d6e76253..9e434515edf 100644
--- a/src/nsselect.m
+++ b/src/nsselect.m
@@ -542,8 +542,8 @@ DEFUN ("ns-store-cut-buffer-internal", Fns_store_cut_buffer_internal,
542void 542void
543nxatoms_of_nsselect (void) 543nxatoms_of_nsselect (void)
544{ 544{
545 NXPrimaryPboard = @"PrimarySelection"; 545 NXPrimaryPboard = @"Selection";
546 NXSecondaryPboard = @"SecondarySelection"; 546 NXSecondaryPboard = @"Secondary";
547} 547}
548 548
549void 549void
diff --git a/src/w32term.c b/src/w32term.c
index 947ed5c9d44..992538e0e88 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -4897,6 +4897,11 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row,
4897 4897
4898 w->phys_cursor_width = width; 4898 w->phys_cursor_width = width;
4899 4899
4900 /* If the character under cursor is R2L, draw the bar cursor
4901 on the right of its glyph, rather than on the left. */
4902 if ((cursor_glyph->resolved_level & 1) != 0)
4903 x += cursor_glyph->pixel_width - width;
4904
4900 w32_fill_area (f, hdc, cursor_color, x, 4905 w32_fill_area (f, hdc, cursor_color, x,
4901 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), 4906 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
4902 width, row->height); 4907 width, row->height);
diff --git a/src/xterm.c b/src/xterm.c
index 4325fb3d991..c049ce78913 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -7152,14 +7152,20 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text
7152 7152
7153 if (kind == BAR_CURSOR) 7153 if (kind == BAR_CURSOR)
7154 { 7154 {
7155 int x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
7156
7155 if (width < 0) 7157 if (width < 0)
7156 width = FRAME_CURSOR_WIDTH (f); 7158 width = FRAME_CURSOR_WIDTH (f);
7157 width = min (cursor_glyph->pixel_width, width); 7159 width = min (cursor_glyph->pixel_width, width);
7158 7160
7159 w->phys_cursor_width = width; 7161 w->phys_cursor_width = width;
7160 7162
7161 XFillRectangle (dpy, window, gc, 7163 /* If the character under cursor is R2L, draw the bar cursor
7162 WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), 7164 on the right of its glyph, rather than on the left. */
7165 if ((cursor_glyph->resolved_level & 1) != 0)
7166 x += cursor_glyph->pixel_width - width;
7167
7168 XFillRectangle (dpy, window, gc, x,
7163 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), 7169 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
7164 width, row->height); 7170 width, row->height);
7165 } 7171 }