aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2013-03-09 00:03:56 +0100
committerJoakim Verona2013-03-09 00:03:56 +0100
commit4b882bf72aa0ed074cde5c27af51b8cf0b4d8620 (patch)
treed32cae5604492ab5734e22a2b10084b0e2fda0ab
parent3a9e4f9ae9be6b16a33789a81b314e6efc7821c7 (diff)
parent457882c20c301f076ff6a4ef7ffd78ed3d35e699 (diff)
downloademacs-4b882bf72aa0ed074cde5c27af51b8cf0b4d8620.tar.gz
emacs-4b882bf72aa0ed074cde5c27af51b8cf0b4d8620.zip
auto upstream
-rw-r--r--doc/misc/ChangeLog10
-rw-r--r--doc/misc/calc.texi4
-rw-r--r--doc/misc/faq.texi3
-rw-r--r--lisp/ChangeLog29
-rw-r--r--lisp/calc/calc-units.el12
-rw-r--r--lisp/hi-lock.el75
-rw-r--r--lisp/org/ChangeLog6
-rw-r--r--lisp/org/org-exp.el3
-rw-r--r--lisp/replace.el10
-rw-r--r--lisp/subr.el16
-rw-r--r--src/ChangeLog58
-rw-r--r--src/bidi.c28
-rw-r--r--src/editfns.c6
-rw-r--r--src/indent.c19
-rw-r--r--src/lisp.h17
-rw-r--r--src/print.c36
-rw-r--r--src/process.c82
-rw-r--r--src/process.h8
-rw-r--r--src/region-cache.c10
-rw-r--r--src/scroll.c17
-rw-r--r--src/search.c83
-rw-r--r--src/xdisp.c24
22 files changed, 351 insertions, 205 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 12230bfb374..44a0b7b3211 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,13 @@
12013-03-08 Glenn Morris <rgm@gnu.org>
2
3 * faq.texi (Top): Don't say this was updated @today.
4 That's irrelevant and leads to spurious diffs.
5
62013-03-08 Jay Belanger <jay.p.belanger@gmail.com>
7
8 * calc.texi (Basic Operations on Units): Fix
9 cross-reference.
10
12013-03-07 Katsumi Yamaoka <yamaoka@jpl.org> 112013-03-07 Katsumi Yamaoka <yamaoka@jpl.org>
2 12
3 * gnus-faq.texi (FAQ 3-11): Now Gnus supports POP3 UIDL. 13 * gnus-faq.texi (FAQ 3-11): Now Gnus supports POP3 UIDL.
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi
index 2d1f59cfa68..0bf7833ec34 100644
--- a/doc/misc/calc.texi
+++ b/doc/misc/calc.texi
@@ -27918,8 +27918,8 @@ simplified so that it doesn't contain any units, like @samp{ft/in} can
27918be simplified to 12, then @kbd{u c} will still prompt for both old 27918be simplified to 12, then @kbd{u c} will still prompt for both old
27919units and new units. You can ignore the prompt for old units with 27919units and new units. You can ignore the prompt for old units with
27920@key{RET}, or turn off the prompt by setting the customizable variable 27920@key{RET}, or turn off the prompt by setting the customizable variable
27921@code{calc-allow-units-as-numbers} to @code{nil}. 27921@code{calc-allow-units-as-numbers} to @code{nil};
27922@pxref{Customizing Calc}) Assuming the old and new units you give are 27922@pxref{Customizing Calc}.) Assuming the old and new units you give are
27923consistent with each other, the result also will not contain any 27923consistent with each other, the result also will not contain any
27924units. For example, @kbd{@w{u c} cm @key{RET} in @key{RET}} converts 27924units. For example, @kbd{@w{u c} cm @key{RET} in @key{RET}} converts
27925the number 2 on the stack to 5.08. 27925the number 2 on the stack to 5.08.
diff --git a/doc/misc/faq.texi b/doc/misc/faq.texi
index 39b4a9037bd..18e3340a474 100644
--- a/doc/misc/faq.texi
+++ b/doc/misc/faq.texi
@@ -58,8 +58,7 @@ distribution.]
58@node Top, FAQ notation, (dir), (dir) 58@node Top, FAQ notation, (dir), (dir)
59@top The GNU Emacs FAQ 59@top The GNU Emacs FAQ
60 60
61@c FIXME @today is just the day we ran `makeinfo'. 61This is the GNU Emacs FAQ.
62This is the GNU Emacs FAQ, last updated on @today{}.
63 62
64This FAQ is maintained as a part of GNU Emacs. If you find any errors, 63This FAQ is maintained as a part of GNU Emacs. If you find any errors,
65or have any suggestions, please use @kbd{M-x report-emacs-bug} to report 64or have any suggestions, please use @kbd{M-x report-emacs-bug} to report
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4f24f5b2c8c..9dc7f06e02c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,23 +1,36 @@
12013-03-07 Karl Fogel <kfogel@red-bean.com> 12013-03-08 Jambunathan K <kjambunathan@gmail.com>
2
3 * hi-lock.el (hi-lock-read-regexp-defaults-function): New var.
4 (hi-lock-read-regexp-defaults): New defun.
5 (hi-lock-line-face-buffer, hi-lock-face-buffer)
6 (hi-lock-face-phrase-buffer): Propagate above change. Update
7 docstring (bug#13892).
8
9 * subr.el (find-tag-default-as-regexp): New defun.
10 * replace.el (read-regexp): Propagate above change.
11
122013-03-08 Jay Belanger <jay.p.belanger@gmail.com>
13
14 * calc/calc-units.el (calc-convert-units): Fix the way that default
15 new units are stored.
16
172013-03-07 Matthias Meulien <orontee@gmail.com>
2 18
3 * bookmark.el: Define a face to highlight bookmark names in 19 * bookmark.el: Define a face to highlight bookmark names in
4 bookmark menu buffers, where the default is a bold face similarly 20 bookmark menu buffers, where the default is a bold face similarly
5 to buffer names in buffer menu buffers. Patch by Matthias Meulien 21 to buffer names in buffer menu buffers.
6 <orontee {_AT_} gmail.com>.
7
8 (bookmark-menu-bookmark): New face to highlight bookmark names. 22 (bookmark-menu-bookmark): New face to highlight bookmark names.
9 (bookmark-insert-location): Remove duplicated text property to 23 (bookmark-insert-location): Remove duplicated text property to
10 conform to buffer list (see `list-buffers'). 24 conform to buffer list (see `list-buffers').
11 (bookmark-bmenu-list, bookmark-bmenu-hide-filenames): Apply face 25 (bookmark-bmenu-list, bookmark-bmenu-hide-filenames): Apply face
12 `bookmark-menu-bookmark' to bookmark names. 26 `bookmark-menu-bookmark' to bookmark names.
13 27
142013-03-07 Karl Fogel <kfogel@red-bean.com> 282013-03-07 Matthias Meulien <orontee@gmail.com>
29 Karl Fogel <kfogel@red-bean.com>
15 30
16 * bookmark.el: Display the bookmark list header similarly to the 31 * bookmark.el: Display the bookmark list header similarly to the
17 buffer list header (see `list-buffers'), where the default is now 32 buffer list header (see `list-buffers'), where the default is now
18 an immovable/immutable header line. Patch by Matthias Meulien 33 an immovable/immutable header line.
19 <orontee {_AT_} gmail.com> with a few tweaks by me.
20
21 (bookmark-bmenu-use-header-line): New variable. 34 (bookmark-bmenu-use-header-line): New variable.
22 (bookmark-bmenu-inline-header-height): New name for 35 (bookmark-bmenu-inline-header-height): New name for
23 `bookmark-bmenu-header-height', to avoid confusion with the code 36 `bookmark-bmenu-header-height', to avoid confusion with the code
diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el
index b334d7b3b45..335980af4dd 100644
--- a/lisp/calc/calc-units.el
+++ b/lisp/calc/calc-units.el
@@ -503,11 +503,13 @@ If COMP or STD is non-nil, put that in the units table instead."
503 (comp (eq (car-safe units) '+))) 503 (comp (eq (car-safe units) '+)))
504 (unless (or unew std) 504 (unless (or unew std)
505 (error "No units specified")) 505 (error "No units specified"))
506 (let ((res 506 (let* ((noold (and uoldname (not (equal uoldname "1"))))
507 (if std 507 (res
508 (math-simplify-units (math-to-standard-units expr (nth 1 std))) 508 (if std
509 (math-convert-units expr units (and uoldname (not (equal uoldname "1"))))))) 509 (math-simplify-units (math-to-standard-units expr (nth 1 std)))
510 (math-put-default-units res (if comp units)) 510 (math-convert-units expr units noold))))
511 (unless std
512 (math-put-default-units (if noold units res) (if comp units)))
511 (calc-enter-result 1 "cvun" res)))))) 513 (calc-enter-result 1 "cvun" res))))))
512 514
513(defun calc-autorange-units (arg) 515(defun calc-autorange-units (arg)
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index cbd8ac5ebad..38e5e8acb15 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -279,6 +279,26 @@ a library is being loaded.")
279 map) 279 map)
280 "Key map for hi-lock.") 280 "Key map for hi-lock.")
281 281
282(defvar hi-lock-read-regexp-defaults-function
283 'hi-lock-read-regexp-defaults
284 "Function that provides default regexp(s) for highlighting commands.
285This function should take no arguments and return one of nil, a
286regexp or a list of regexps for use with highlighting commands -
287`hi-lock-face-phrase-buffer', `hi-lock-line-face-buffer' and
288`hi-lock-face-buffer'. The return value of this function is used
289as DEFAULTS param of `read-regexp' while executing the
290highlighting command. This function is called only during
291interactive use.
292
293For example, to highlight at symbol at point use
294
295 \(setq hi-lock-read-regexp-defaults-function
296 'find-tag-default-as-regexp\)
297
298If you need different defaults for different highlighting
299operations, use `this-command' to identify the command under
300execution.")
301
282;; Visible Functions 302;; Visible Functions
283 303
284;;;###autoload 304;;;###autoload
@@ -399,17 +419,18 @@ versions before 22 use the following in your init file:
399;;;###autoload 419;;;###autoload
400(defun hi-lock-line-face-buffer (regexp &optional face) 420(defun hi-lock-line-face-buffer (regexp &optional face)
401 "Set face of all lines containing a match of REGEXP to FACE. 421 "Set face of all lines containing a match of REGEXP to FACE.
402Interactively, prompt for REGEXP then FACE, using a buffer-local 422Interactively, prompt for REGEXP then FACE. Use
403history list for REGEXP and a global history list for FACE. 423`hi-lock-read-regexp-defaults-function' to retrieve default
424value(s) of REGEXP. Use the global history list for FACE.
404 425
405If Font Lock mode is enabled in the buffer, it is used to 426Use Font lock mode, if enabled, to highlight REGEXP. Otherwise,
406highlight REGEXP. If Font Lock mode is disabled, overlays are 427use overlays for highlighting. If overlays are used, the
407used for highlighting; in this case, the highlighting will not be 428highlighting will not update as you type."
408updated as you type."
409 (interactive 429 (interactive
410 (list 430 (list
411 (hi-lock-regexp-okay 431 (hi-lock-regexp-okay
412 (read-regexp "Regexp to highlight line" (car regexp-history))) 432 (read-regexp "Regexp to highlight line"
433 (funcall hi-lock-read-regexp-defaults-function)))
413 (hi-lock-read-face-name))) 434 (hi-lock-read-face-name)))
414 (or (facep face) (setq face 'hi-yellow)) 435 (or (facep face) (setq face 'hi-yellow))
415 (unless hi-lock-mode (hi-lock-mode 1)) 436 (unless hi-lock-mode (hi-lock-mode 1))
@@ -424,17 +445,18 @@ updated as you type."
424;;;###autoload 445;;;###autoload
425(defun hi-lock-face-buffer (regexp &optional face) 446(defun hi-lock-face-buffer (regexp &optional face)
426 "Set face of each match of REGEXP to FACE. 447 "Set face of each match of REGEXP to FACE.
427Interactively, prompt for REGEXP then FACE, using a buffer-local 448Interactively, prompt for REGEXP then FACE. Use
428history list for REGEXP and a global history list for FACE. 449`hi-lock-read-regexp-defaults-function' to retrieve default
450value(s) REGEXP. Use the global history list for FACE.
429 451
430If Font Lock mode is enabled in the buffer, it is used to 452Use Font lock mode, if enabled, to highlight REGEXP. Otherwise,
431highlight REGEXP. If Font Lock mode is disabled, overlays are 453use overlays for highlighting. If overlays are used, the
432used for highlighting; in this case, the highlighting will not be 454highlighting will not update as you type."
433updated as you type."
434 (interactive 455 (interactive
435 (list 456 (list
436 (hi-lock-regexp-okay 457 (hi-lock-regexp-okay
437 (read-regexp "Regexp to highlight" (car regexp-history))) 458 (read-regexp "Regexp to highlight"
459 (funcall hi-lock-read-regexp-defaults-function)))
438 (hi-lock-read-face-name))) 460 (hi-lock-read-face-name)))
439 (or (facep face) (setq face 'hi-yellow)) 461 (or (facep face) (setq face 'hi-yellow))
440 (unless hi-lock-mode (hi-lock-mode 1)) 462 (unless hi-lock-mode (hi-lock-mode 1))
@@ -445,18 +467,22 @@ updated as you type."
445;;;###autoload 467;;;###autoload
446(defun hi-lock-face-phrase-buffer (regexp &optional face) 468(defun hi-lock-face-phrase-buffer (regexp &optional face)
447 "Set face of each match of phrase REGEXP to FACE. 469 "Set face of each match of phrase REGEXP to FACE.
448If called interactively, replaces whitespace in REGEXP with 470Interactively, prompt for REGEXP then FACE. Use
449arbitrary whitespace and makes initial lower-case letters case-insensitive. 471`hi-lock-read-regexp-defaults-function' to retrieve default
450 472value(s) of REGEXP. Use the global history list for FACE. When
451If Font Lock mode is enabled in the buffer, it is used to 473called interactively, replace whitespace in user provided regexp
452highlight REGEXP. If Font Lock mode is disabled, overlays are 474with arbitrary whitespace and make initial lower-case letters
453used for highlighting; in this case, the highlighting will not be 475case-insensitive before highlighting with `hi-lock-set-pattern'.
454updated as you type." 476
477Use Font lock mode, if enabled, to highlight REGEXP. Otherwise,
478use overlays for highlighting. If overlays are used, the
479highlighting will not update as you type."
455 (interactive 480 (interactive
456 (list 481 (list
457 (hi-lock-regexp-okay 482 (hi-lock-regexp-okay
458 (hi-lock-process-phrase 483 (hi-lock-process-phrase
459 (read-regexp "Phrase to highlight" (car regexp-history)))) 484 (read-regexp "Phrase to highlight"
485 (funcall hi-lock-read-regexp-defaults-function))))
460 (hi-lock-read-face-name))) 486 (hi-lock-read-face-name)))
461 (or (facep face) (setq face 'hi-yellow)) 487 (or (facep face) (setq face 'hi-yellow))
462 (unless hi-lock-mode (hi-lock-mode 1)) 488 (unless hi-lock-mode (hi-lock-mode 1))
@@ -622,6 +648,11 @@ not suitable."
622 (error "Regexp cannot match an empty string") 648 (error "Regexp cannot match an empty string")
623 regexp)) 649 regexp))
624 650
651(defun hi-lock-read-regexp-defaults ()
652 "Return the latest regexp from `regexp-history'.
653See `hi-lock-read-regexp-defaults-function' for details."
654 (car regexp-history))
655
625(defun hi-lock-read-face-name () 656(defun hi-lock-read-face-name ()
626 "Return face for interactive highlighting. 657 "Return face for interactive highlighting.
627When `hi-lock-auto-select-face' is non-nil, just return the next face. 658When `hi-lock-auto-select-face' is non-nil, just return the next face.
diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog
index 5626b611f0d..1bf6fe315c1 100644
--- a/lisp/org/ChangeLog
+++ b/lisp/org/ChangeLog
@@ -1,3 +1,9 @@
12013-03-08 Bastien Guerry <bzg@gnu.org>
2
3 * org-exp.el (org-export-normalize-links): Fix critical bug: do
4 not rely on `org-context' to guess where to prevent links
5 normalization.
6
12013-02-28 Achim Gratz <Stromeko@Stromeko.DE> 72013-02-28 Achim Gratz <Stromeko@Stromeko.DE>
2 8
3 * org.el (org-org-menu): Use correct key "C-u C-c C-x !" to do 9 * org.el (org-org-menu): Use correct key "C-u C-c C-x !" to do
diff --git a/lisp/org/org-exp.el b/lisp/org/org-exp.el
index 5ccaec3e67f..82b9003e4fd 100644
--- a/lisp/org/org-exp.el
+++ b/lisp/org/org-exp.el
@@ -2113,8 +2113,7 @@ Also, store forced alignment information found in such lines."
2113 (put-text-property (match-beginning 0) (match-end 0) 'org-normalized-link t)) 2113 (put-text-property (match-beginning 0) (match-end 0) 'org-normalized-link t))
2114 (goto-char (point-min)) 2114 (goto-char (point-min))
2115 (while (re-search-forward re-plain-link nil t) 2115 (while (re-search-forward re-plain-link nil t)
2116 (unless (or (get-text-property (match-beginning 0) 'org-normalized-link) 2116 (unless (get-text-property (match-beginning 0) 'org-normalized-link)
2117 (assoc :tags (org-context)))
2118 (goto-char (1- (match-end 0))) 2117 (goto-char (1- (match-end 0)))
2119 (org-if-unprotected-at (1+ (match-beginning 0)) 2118 (org-if-unprotected-at (1+ (match-beginning 0))
2120 (let* ((s (concat (match-string 1) 2119 (let* ((s (concat (match-string 1)
diff --git a/lisp/replace.el b/lisp/replace.el
index 86b1aa27069..ceb0fe4a63e 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -603,15 +603,7 @@ If HISTORY is nil, `regexp-history' is used."
603 (append 603 (append
604 suggestions 604 suggestions
605 (list 605 (list
606 ;; Regexp for tag at point. 606 (find-tag-default-as-regexp)
607 (let* ((tagf (or find-tag-default-function
608 (get major-mode 'find-tag-default-function)
609 'find-tag-default))
610 (tag (funcall tagf)))
611 (cond ((not tag) "")
612 ((eq tagf 'find-tag-default)
613 (format "\\_<%s\\_>" (regexp-quote tag)))
614 (t (regexp-quote tag))))
615 (car regexp-search-ring) 607 (car regexp-search-ring)
616 (regexp-quote (or (car search-ring) "")) 608 (regexp-quote (or (car search-ring) ""))
617 (car (symbol-value query-replace-from-history-variable))))) 609 (car (symbol-value query-replace-from-history-variable)))))
diff --git a/lisp/subr.el b/lisp/subr.el
index db2b6a8eaad..9a7b94208fe 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2697,6 +2697,22 @@ If there is no plausible default, return nil."
2697 (setq to (point))))) 2697 (setq to (point)))))
2698 (buffer-substring-no-properties from to)))) 2698 (buffer-substring-no-properties from to))))
2699 2699
2700(defun find-tag-default-as-regexp ()
2701 "Return regexp that matches the default tag at point.
2702If there is no tag at point, return nil.
2703
2704When in a major mode that does not provide its own
2705`find-tag-default-function', return a regexp that matches the
2706symbol at point exactly."
2707 (let* ((tagf (or find-tag-default-function
2708 (get major-mode 'find-tag-default-function)
2709 'find-tag-default))
2710 (tag (funcall tagf)))
2711 (cond ((not tag))
2712 ((eq tagf 'find-tag-default)
2713 (format "\\_<%s\\_>" (regexp-quote tag)))
2714 (t (regexp-quote tag)))))
2715
2700(defun play-sound (sound) 2716(defun play-sound (sound)
2701 "SOUND is a list of the form `(sound KEYWORD VALUE...)'. 2717 "SOUND is a list of the form `(sound KEYWORD VALUE...)'.
2702The following keywords are recognized: 2718The following keywords are recognized:
diff --git a/src/ChangeLog b/src/ChangeLog
index 54b1fd04503..69e8303111a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,61 @@
12013-03-08 Paul Eggert <eggert@cs.ucla.edu>
2
3 region-cache.c, scroll.c, search.c: Use bool for booleans.
4 * lisp.h (compile_pattern):
5 * scroll.c (do_scrolling, do_direct_scrolling):
6 * search.c (struct regexp_cache, compile_pattern_1)
7 (compile_pattern, string_match_1, search_command)
8 (trivial_regexp_p, search_buffer, Freplace_match, match_limit)
9 (search_regs_saved, Fregexp_quote):
10 Use bool for boolean.
11 * region-cache.c (region_cache_forward, region_cache_backward):
12 Fix comments to match code: these functions return int, not boolean.
13
142013-03-08 Dmitry Antipov <dmantipov@yandex.ru>
15
16 * search.c (find_newline): Accept start and end byte positions
17 as arguments and allow -1 if not known.
18 (find_newline_no_quit): Likewise for start position.
19 * lisp.h (find_newline, find_newline_no_quit): Adjust prototype.
20 * bidi.c (bidi_find_paragraph_start): Pass byte position to
21 find_newline_no_quit, thus eliminating CHAR_TO_BYTE.
22 * editfns.c (Fconstrain_to_field): Break long line. Adjust
23 call to find_newline.
24 * indent.c (vmotion): Adjust calls to find_newline_no_quit.
25 Use DEC_BOTH to start next search from the previous buffer
26 position, where appropriate.
27 * xdisp.c (back_to_previous_line_start, forward_to_next_line_start)
28 (get_visually_first_element, move_it_vertically_backward): Likewise.
29 Obtain byte position from the display iterator, where appropriate.
30
312013-03-08 Paul Eggert <eggert@cs.ucla.edu>
32
33 print.c, process.c: Use bool for booleans.
34 * lisp.h (wait_reading_process_output):
35 * print.c (print_output_debug_flag, PRINTDECLARE, printchar)
36 (strout, debug_output_compilation_hack, float_to_string, print)
37 (print_object):
38 * process.c (kbd_is_on_hold, inhibit_sentinels, process_output_skip)
39 (decode_status, status_message, create_process, create_pty)
40 (Fmake_network_process, Fnetwork_interface_info)
41 (wait_reading_process_output, read_process_output)
42 (write_queue_push, write_queue_pop, process_send_signal)
43 (handle_child_signal, keyboard_bit_set, kbd_on_hold_p):
44 * process.h (struct Lisp_Process, inhibit_sentinels, kbd_on_hold_p):
45 Use bool for booleans.
46 * process.c (Fnetwork_interface_list): Remove unused local.
47 (connect_counter): Now EMACS_INT, not int.
48
492013-03-08 Dmitry Antipov <dmantipov@yandex.ru>
50
51 * bidi.c (bidi_fetch_char): Swap first and second arguments
52 to match other functions accepting character and byte positions.
53 Adjust comment.
54 (bidi_resolve_explicit_1, bidi_level_of_next_char): Adjust users.
55 (bidi_paragraph_init): Likewise. Use DEC_BOTH which is faster
56 when you need just to move to the previous buffer position.
57 * xdisp.c (Fcurrent_bidi_paragraph_direction): Use DEC_BOTH.
58
12013-03-07 Eli Zaretskii <eliz@gnu.org> 592013-03-07 Eli Zaretskii <eliz@gnu.org>
2 60
3 * .gdbinit (prowlims): Display the enabled_p flag of the row. 61 * .gdbinit (prowlims): Display the enabled_p flag of the row.
diff --git a/src/bidi.c b/src/bidi.c
index cf5e580cd8f..c6bea62f67b 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -910,7 +910,7 @@ bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, bool unibyte)
910 return STRING_CHAR (s); 910 return STRING_CHAR (s);
911} 911}
912 912
913/* Fetch and return the character at BYTEPOS/CHARPOS. If that 913/* Fetch and return the character at CHARPOS/BYTEPOS. If that
914 character is covered by a display string, treat the entire run of 914 character is covered by a display string, treat the entire run of
915 covered characters as a single character, either u+2029 or u+FFFC, 915 covered characters as a single character, either u+2029 or u+FFFC,
916 and return their combined length in CH_LEN and NCHARS. DISP_POS 916 and return their combined length in CH_LEN and NCHARS. DISP_POS
@@ -925,7 +925,7 @@ bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, bool unibyte)
925 string to iterate, or NULL if iterating over a buffer or a Lisp 925 string to iterate, or NULL if iterating over a buffer or a Lisp
926 string; in the latter case, STRING->lstring is the Lisp string. */ 926 string; in the latter case, STRING->lstring is the Lisp string. */
927static int 927static int
928bidi_fetch_char (ptrdiff_t bytepos, ptrdiff_t charpos, ptrdiff_t *disp_pos, 928bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos,
929 int *disp_prop, struct bidi_string_data *string, 929 int *disp_prop, struct bidi_string_data *string,
930 bool frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars) 930 bool frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars)
931{ 931{
@@ -1104,11 +1104,14 @@ bidi_find_paragraph_start (ptrdiff_t pos, ptrdiff_t pos_byte)
1104 while (pos_byte > BEGV_BYTE 1104 while (pos_byte > BEGV_BYTE
1105 && n++ < MAX_PARAGRAPH_SEARCH 1105 && n++ < MAX_PARAGRAPH_SEARCH
1106 && fast_looking_at (re, pos, pos_byte, limit, limit_byte, Qnil) < 0) 1106 && fast_looking_at (re, pos, pos_byte, limit, limit_byte, Qnil) < 0)
1107 /* FIXME: What if the paragraph beginning is covered by a 1107 {
1108 display string? And what if a display string covering some 1108 /* FIXME: What if the paragraph beginning is covered by a
1109 of the text over which we scan back includes 1109 display string? And what if a display string covering some
1110 paragraph_start_re? */ 1110 of the text over which we scan back includes
1111 pos = find_newline_no_quit (pos - 1, -1, &pos_byte); 1111 paragraph_start_re? */
1112 DEC_BOTH (pos, pos_byte);
1113 pos = find_newline_no_quit (pos, pos_byte, -1, &pos_byte);
1114 }
1112 if (n >= MAX_PARAGRAPH_SEARCH) 1115 if (n >= MAX_PARAGRAPH_SEARCH)
1113 pos_byte = BEGV_BYTE; 1116 pos_byte = BEGV_BYTE;
1114 return pos_byte; 1117 return pos_byte;
@@ -1220,7 +1223,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p)
1220 bytepos = pstartbyte; 1223 bytepos = pstartbyte;
1221 if (!string_p) 1224 if (!string_p)
1222 pos = BYTE_TO_CHAR (bytepos); 1225 pos = BYTE_TO_CHAR (bytepos);
1223 ch = bidi_fetch_char (bytepos, pos, &disp_pos, &disp_prop, 1226 ch = bidi_fetch_char (pos, bytepos, &disp_pos, &disp_prop,
1224 &bidi_it->string, 1227 &bidi_it->string,
1225 bidi_it->frame_window_p, &ch_len, &nchars); 1228 bidi_it->frame_window_p, &ch_len, &nchars);
1226 type = bidi_get_type (ch, NEUTRAL_DIR); 1229 type = bidi_get_type (ch, NEUTRAL_DIR);
@@ -1248,7 +1251,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p)
1248 && bidi_at_paragraph_end (pos, bytepos) >= -1) 1251 && bidi_at_paragraph_end (pos, bytepos) >= -1)
1249 break; 1252 break;
1250 /* Fetch next character and advance to get past it. */ 1253 /* Fetch next character and advance to get past it. */
1251 ch = bidi_fetch_char (bytepos, pos, &disp_pos, 1254 ch = bidi_fetch_char (pos, bytepos, &disp_pos,
1252 &disp_prop, &bidi_it->string, 1255 &disp_prop, &bidi_it->string,
1253 bidi_it->frame_window_p, &ch_len, &nchars); 1256 bidi_it->frame_window_p, &ch_len, &nchars);
1254 pos += nchars; 1257 pos += nchars;
@@ -1279,8 +1282,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p)
1279 /* FXIME: What if p is covered by a display 1282 /* FXIME: What if p is covered by a display
1280 string? See also a FIXME inside 1283 string? See also a FIXME inside
1281 bidi_find_paragraph_start. */ 1284 bidi_find_paragraph_start. */
1282 p--; 1285 DEC_BOTH (p, pbyte);
1283 pbyte = CHAR_TO_BYTE (p);
1284 prevpbyte = bidi_find_paragraph_start (p, pbyte); 1286 prevpbyte = bidi_find_paragraph_start (p, pbyte);
1285 } 1287 }
1286 pstartbyte = prevpbyte; 1288 pstartbyte = prevpbyte;
@@ -1398,7 +1400,7 @@ bidi_resolve_explicit_1 (struct bidi_it *bidi_it)
1398 /* Fetch the character at BYTEPOS. If it is covered by a 1400 /* Fetch the character at BYTEPOS. If it is covered by a
1399 display string, treat the entire run of covered characters as 1401 display string, treat the entire run of covered characters as
1400 a single character u+FFFC. */ 1402 a single character u+FFFC. */
1401 curchar = bidi_fetch_char (bidi_it->bytepos, bidi_it->charpos, 1403 curchar = bidi_fetch_char (bidi_it->charpos, bidi_it->bytepos,
1402 &bidi_it->disp_pos, &bidi_it->disp_prop, 1404 &bidi_it->disp_pos, &bidi_it->disp_prop,
1403 &bidi_it->string, bidi_it->frame_window_p, 1405 &bidi_it->string, bidi_it->frame_window_p,
1404 &bidi_it->ch_len, &bidi_it->nchars); 1406 &bidi_it->ch_len, &bidi_it->nchars);
@@ -2191,7 +2193,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
2191 if (bidi_it->nchars <= 0) 2193 if (bidi_it->nchars <= 0)
2192 emacs_abort (); 2194 emacs_abort ();
2193 do { 2195 do {
2194 ch = bidi_fetch_char (bpos += clen, cpos += nc, &disp_pos, &dpp, &bs, 2196 ch = bidi_fetch_char (cpos += nc, bpos += clen, &disp_pos, &dpp, &bs,
2195 fwp, &clen, &nc); 2197 fwp, &clen, &nc);
2196 if (ch == '\n' || ch == BIDI_EOB) 2198 if (ch == '\n' || ch == BIDI_EOB)
2197 chtype = NEUTRAL_B; 2199 chtype = NEUTRAL_B;
diff --git a/src/editfns.c b/src/editfns.c
index e1813dc65a1..f34c574cae3 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -669,7 +669,8 @@ If the optional argument INHIBIT-CAPTURE-PROPERTY is non-nil, and OLD-POS has
669a non-nil property of that name, then any field boundaries are ignored. 669a non-nil property of that name, then any field boundaries are ignored.
670 670
671Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */) 671Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */)
672 (Lisp_Object new_pos, Lisp_Object old_pos, Lisp_Object escape_from_edge, Lisp_Object only_in_line, Lisp_Object inhibit_capture_property) 672 (Lisp_Object new_pos, Lisp_Object old_pos, Lisp_Object escape_from_edge,
673 Lisp_Object only_in_line, Lisp_Object inhibit_capture_property)
673{ 674{
674 /* If non-zero, then the original point, before re-positioning. */ 675 /* If non-zero, then the original point, before re-positioning. */
675 ptrdiff_t orig_point = 0; 676 ptrdiff_t orig_point = 0;
@@ -735,7 +736,8 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */)
735 /* This is the ONLY_IN_LINE case, check that NEW_POS and 736 /* This is the ONLY_IN_LINE case, check that NEW_POS and
736 FIELD_BOUND are on the same line by seeing whether 737 FIELD_BOUND are on the same line by seeing whether
737 there's an intervening newline or not. */ 738 there's an intervening newline or not. */
738 || (find_newline (XFASTINT (new_pos), XFASTINT (field_bound), 739 || (find_newline (XFASTINT (new_pos), -1,
740 XFASTINT (field_bound), -1,
739 fwd ? -1 : 1, &shortage, NULL, 1), 741 fwd ? -1 : 1, &shortage, NULL, 1),
740 shortage != 0))) 742 shortage != 0)))
741 /* Constrain NEW_POS to FIELD_BOUND. */ 743 /* Constrain NEW_POS to FIELD_BOUND. */
diff --git a/src/indent.c b/src/indent.c
index fd692f0b149..d1f95da6bcf 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1840,10 +1840,13 @@ vmotion (register ptrdiff_t from, register ptrdiff_t from_byte,
1840 1840
1841 while ((vpos > vtarget || first) && from > BEGV) 1841 while ((vpos > vtarget || first) && from > BEGV)
1842 { 1842 {
1843 ptrdiff_t bytepos; 1843 ptrdiff_t bytepos = from_byte;
1844 Lisp_Object propval; 1844 Lisp_Object propval;
1845 1845
1846 prevline = find_newline_no_quit (from - 1, -1, &bytepos); 1846 prevline = from;
1847 DEC_BOTH (prevline, bytepos);
1848 prevline = find_newline_no_quit (prevline, bytepos, -1, &bytepos);
1849
1847 while (prevline > BEGV 1850 while (prevline > BEGV
1848 && ((selective > 0 1851 && ((selective > 0
1849 && indented_beyond_p (prevline, bytepos, selective)) 1852 && indented_beyond_p (prevline, bytepos, selective))
@@ -1853,7 +1856,10 @@ vmotion (register ptrdiff_t from, register ptrdiff_t from_byte,
1853 Qinvisible, 1856 Qinvisible,
1854 text_prop_object), 1857 text_prop_object),
1855 TEXT_PROP_MEANS_INVISIBLE (propval)))) 1858 TEXT_PROP_MEANS_INVISIBLE (propval))))
1856 prevline = find_newline_no_quit (prevline - 1, -1, &bytepos); 1859 {
1860 DEC_BOTH (prevline, bytepos);
1861 prevline = find_newline_no_quit (prevline, bytepos, -1, &bytepos);
1862 }
1857 pos = *compute_motion (prevline, bytepos, 0, lmargin, 0, from, 1863 pos = *compute_motion (prevline, bytepos, 0, lmargin, 0, from,
1858 /* Don't care for VPOS... */ 1864 /* Don't care for VPOS... */
1859 1 << (BITS_PER_SHORT - 1), 1865 1 << (BITS_PER_SHORT - 1),
@@ -1890,7 +1896,7 @@ vmotion (register ptrdiff_t from, register ptrdiff_t from_byte,
1890 ptrdiff_t bytepos; 1896 ptrdiff_t bytepos;
1891 Lisp_Object propval; 1897 Lisp_Object propval;
1892 1898
1893 prevline = find_newline_no_quit (from, -1, &bytepos); 1899 prevline = find_newline_no_quit (from, from_byte, -1, &bytepos);
1894 while (prevline > BEGV 1900 while (prevline > BEGV
1895 && ((selective > 0 1901 && ((selective > 0
1896 && indented_beyond_p (prevline, bytepos, selective)) 1902 && indented_beyond_p (prevline, bytepos, selective))
@@ -1900,7 +1906,10 @@ vmotion (register ptrdiff_t from, register ptrdiff_t from_byte,
1900 Qinvisible, 1906 Qinvisible,
1901 text_prop_object), 1907 text_prop_object),
1902 TEXT_PROP_MEANS_INVISIBLE (propval)))) 1908 TEXT_PROP_MEANS_INVISIBLE (propval))))
1903 prevline = find_newline_no_quit (prevline - 1, -1, &bytepos); 1909 {
1910 DEC_BOTH (prevline, bytepos);
1911 prevline = find_newline_no_quit (prevline, bytepos, -1, &bytepos);
1912 }
1904 pos = *compute_motion (prevline, bytepos, 0, lmargin, 0, from, 1913 pos = *compute_motion (prevline, bytepos, 0, lmargin, 0, from,
1905 /* Don't care for VPOS... */ 1914 /* Don't care for VPOS... */
1906 1 << (BITS_PER_SHORT - 1), 1915 1 << (BITS_PER_SHORT - 1),
diff --git a/src/lisp.h b/src/lisp.h
index 85cf981d9b2..b46f466406b 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3362,18 +3362,19 @@ extern void record_unwind_save_match_data (void);
3362struct re_registers; 3362struct re_registers;
3363extern struct re_pattern_buffer *compile_pattern (Lisp_Object, 3363extern struct re_pattern_buffer *compile_pattern (Lisp_Object,
3364 struct re_registers *, 3364 struct re_registers *,
3365 Lisp_Object, int, bool); 3365 Lisp_Object, bool, bool);
3366extern ptrdiff_t fast_string_match (Lisp_Object, Lisp_Object); 3366extern ptrdiff_t fast_string_match (Lisp_Object, Lisp_Object);
3367extern ptrdiff_t fast_c_string_match_ignore_case (Lisp_Object, const char *, 3367extern ptrdiff_t fast_c_string_match_ignore_case (Lisp_Object, const char *,
3368 ptrdiff_t); 3368 ptrdiff_t);
3369extern ptrdiff_t fast_string_match_ignore_case (Lisp_Object, Lisp_Object); 3369extern ptrdiff_t fast_string_match_ignore_case (Lisp_Object, Lisp_Object);
3370extern ptrdiff_t fast_looking_at (Lisp_Object, ptrdiff_t, ptrdiff_t, 3370extern ptrdiff_t fast_looking_at (Lisp_Object, ptrdiff_t, ptrdiff_t,
3371 ptrdiff_t, ptrdiff_t, Lisp_Object); 3371 ptrdiff_t, ptrdiff_t, Lisp_Object);
3372extern ptrdiff_t find_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, 3372extern ptrdiff_t find_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t,
3373 ptrdiff_t *, ptrdiff_t *, bool); 3373 ptrdiff_t, ptrdiff_t *, ptrdiff_t *, bool);
3374extern EMACS_INT scan_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, 3374extern EMACS_INT scan_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t,
3375 EMACS_INT, bool); 3375 EMACS_INT, bool);
3376extern ptrdiff_t find_newline_no_quit (ptrdiff_t, ptrdiff_t, ptrdiff_t *); 3376extern ptrdiff_t find_newline_no_quit (ptrdiff_t, ptrdiff_t,
3377 ptrdiff_t, ptrdiff_t *);
3377extern ptrdiff_t find_before_next_newline (ptrdiff_t, ptrdiff_t, 3378extern ptrdiff_t find_before_next_newline (ptrdiff_t, ptrdiff_t,
3378 ptrdiff_t, ptrdiff_t *); 3379 ptrdiff_t, ptrdiff_t *);
3379extern void syms_of_search (void); 3380extern void syms_of_search (void);
@@ -3503,10 +3504,10 @@ extern bool running_asynch_code;
3503extern Lisp_Object QCtype, Qlocal; 3504extern Lisp_Object QCtype, Qlocal;
3504extern Lisp_Object Qprocessp; 3505extern Lisp_Object Qprocessp;
3505extern void kill_buffer_processes (Lisp_Object); 3506extern void kill_buffer_processes (Lisp_Object);
3506extern int wait_reading_process_output (intmax_t, int, int, bool, 3507extern bool wait_reading_process_output (intmax_t, int, int, bool,
3507 Lisp_Object, 3508 Lisp_Object,
3508 struct Lisp_Process *, 3509 struct Lisp_Process *,
3509 int); 3510 int);
3510/* Max value for the first argument of wait_reading_process_output. */ 3511/* Max value for the first argument of wait_reading_process_output. */
3511#if __GNUC__ == 3 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 5) 3512#if __GNUC__ == 3 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 5)
3512/* Work around a bug in GCC 3.4.2, known to be fixed in GCC 4.6.3. 3513/* Work around a bug in GCC 3.4.2, known to be fixed in GCC 4.6.3.
diff --git a/src/print.c b/src/print.c
index 9a84903e306..cc451d2e395 100644
--- a/src/print.c
+++ b/src/print.c
@@ -86,7 +86,7 @@ static ptrdiff_t print_number_index;
86static void print_interval (INTERVAL interval, Lisp_Object printcharfun); 86static void print_interval (INTERVAL interval, Lisp_Object printcharfun);
87 87
88/* GDB resets this to zero on W32 to disable OutputDebugString calls. */ 88/* GDB resets this to zero on W32 to disable OutputDebugString calls. */
89int print_output_debug_flag EXTERNALLY_VISIBLE = 1; 89bool print_output_debug_flag EXTERNALLY_VISIBLE = 1;
90 90
91 91
92/* Low level output routines for characters and strings. */ 92/* Low level output routines for characters and strings. */
@@ -103,7 +103,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
103 ptrdiff_t old_point = -1, start_point = -1; \ 103 ptrdiff_t old_point = -1, start_point = -1; \
104 ptrdiff_t old_point_byte = -1, start_point_byte = -1; \ 104 ptrdiff_t old_point_byte = -1, start_point_byte = -1; \
105 ptrdiff_t specpdl_count = SPECPDL_INDEX (); \ 105 ptrdiff_t specpdl_count = SPECPDL_INDEX (); \
106 int free_print_buffer = 0; \ 106 bool free_print_buffer = 0; \
107 bool multibyte \ 107 bool multibyte \
108 = !NILP (BVAR (current_buffer, enable_multibyte_characters)); \ 108 = !NILP (BVAR (current_buffer, enable_multibyte_characters)); \
109 Lisp_Object original 109 Lisp_Object original
@@ -243,7 +243,7 @@ printchar (unsigned int ch, Lisp_Object fun)
243 } 243 }
244 else 244 else
245 { 245 {
246 int multibyte_p 246 bool multibyte_p
247 = !NILP (BVAR (current_buffer, enable_multibyte_characters)); 247 = !NILP (BVAR (current_buffer, enable_multibyte_characters));
248 248
249 setup_echo_area_for_printing (multibyte_p); 249 setup_echo_area_for_printing (multibyte_p);
@@ -292,7 +292,7 @@ strout (const char *ptr, ptrdiff_t size, ptrdiff_t size_byte,
292 here, that's the reason we don't call printchar to do the 292 here, that's the reason we don't call printchar to do the
293 job. */ 293 job. */
294 int i; 294 int i;
295 int multibyte_p 295 bool multibyte_p
296 = !NILP (BVAR (current_buffer, enable_multibyte_characters)); 296 = !NILP (BVAR (current_buffer, enable_multibyte_characters));
297 297
298 setup_echo_area_for_printing (multibyte_p); 298 setup_echo_area_for_printing (multibyte_p);
@@ -510,10 +510,10 @@ temp_output_buffer_setup (const char *bufname)
510 specbind (Qstandard_output, buf); 510 specbind (Qstandard_output, buf);
511} 511}
512 512
513static void print (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag); 513static void print (Lisp_Object, Lisp_Object, bool);
514static void print_preprocess (Lisp_Object obj); 514static void print_preprocess (Lisp_Object);
515static void print_preprocess_string (INTERVAL interval, Lisp_Object arg); 515static void print_preprocess_string (INTERVAL, Lisp_Object);
516static void print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag); 516static void print_object (Lisp_Object, Lisp_Object, bool);
517 517
518DEFUN ("terpri", Fterpri, Sterpri, 0, 1, 0, 518DEFUN ("terpri", Fterpri, Sterpri, 0, 1, 0,
519 doc: /* Output a newline to stream PRINTCHARFUN. 519 doc: /* Output a newline to stream PRINTCHARFUN.
@@ -729,9 +729,9 @@ to make it write to the debugging output. */)
729/* This function is never called. Its purpose is to prevent 729/* This function is never called. Its purpose is to prevent
730 print_output_debug_flag from being optimized away. */ 730 print_output_debug_flag from being optimized away. */
731 731
732extern void debug_output_compilation_hack (int) EXTERNALLY_VISIBLE; 732extern void debug_output_compilation_hack (bool) EXTERNALLY_VISIBLE;
733void 733void
734debug_output_compilation_hack (int x) 734debug_output_compilation_hack (bool x)
735{ 735{
736 print_output_debug_flag = x; 736 print_output_debug_flag = x;
737} 737}
@@ -969,7 +969,7 @@ float_to_string (char *buf, double data)
969 static char const NaN_string[] = "0.0e+NaN"; 969 static char const NaN_string[] = "0.0e+NaN";
970 int i; 970 int i;
971 union { double d; char c[sizeof (double)]; } u_data, u_minus_zero; 971 union { double d; char c[sizeof (double)]; } u_data, u_minus_zero;
972 int negative = 0; 972 bool negative = 0;
973 u_data.d = data; 973 u_data.d = data;
974 u_minus_zero.d = - 0.0; 974 u_minus_zero.d = - 0.0;
975 for (i = 0; i < sizeof (double); i++) 975 for (i = 0; i < sizeof (double); i++)
@@ -1066,7 +1066,7 @@ float_to_string (char *buf, double data)
1066 1066
1067 1067
1068static void 1068static void
1069print (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag) 1069print (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
1070{ 1070{
1071 new_backquote_output = 0; 1071 new_backquote_output = 0;
1072 1072
@@ -1316,7 +1316,7 @@ print_prune_string_charset (Lisp_Object string)
1316} 1316}
1317 1317
1318static void 1318static void
1319print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag) 1319print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
1320{ 1320{
1321 char buf[max (sizeof "from..to..in " + 2 * INT_STRLEN_BOUND (EMACS_INT), 1321 char buf[max (sizeof "from..to..in " + 2 * INT_STRLEN_BOUND (EMACS_INT),
1322 max (sizeof " . #" + INT_STRLEN_BOUND (printmax_t), 1322 max (sizeof " . #" + INT_STRLEN_BOUND (printmax_t),
@@ -1398,7 +1398,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1398 ptrdiff_t size_byte; 1398 ptrdiff_t size_byte;
1399 /* 1 means we must ensure that the next character we output 1399 /* 1 means we must ensure that the next character we output
1400 cannot be taken as part of a hex character escape. */ 1400 cannot be taken as part of a hex character escape. */
1401 int need_nonhex = 0; 1401 bool need_nonhex = 0;
1402 bool multibyte = STRING_MULTIBYTE (obj); 1402 bool multibyte = STRING_MULTIBYTE (obj);
1403 1403
1404 GCPRO1 (obj); 1404 GCPRO1 (obj);
@@ -1510,10 +1510,10 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1510 1510
1511 case Lisp_Symbol: 1511 case Lisp_Symbol:
1512 { 1512 {
1513 register int confusing; 1513 bool confusing;
1514 register unsigned char *p = SDATA (SYMBOL_NAME (obj)); 1514 unsigned char *p = SDATA (SYMBOL_NAME (obj));
1515 register unsigned char *end = p + SBYTES (SYMBOL_NAME (obj)); 1515 unsigned char *end = p + SBYTES (SYMBOL_NAME (obj));
1516 register int c; 1516 int c;
1517 ptrdiff_t i, i_byte; 1517 ptrdiff_t i, i_byte;
1518 ptrdiff_t size_byte; 1518 ptrdiff_t size_byte;
1519 Lisp_Object name; 1519 Lisp_Object name;
diff --git a/src/process.c b/src/process.c
index 5b15ade1122..bafdca9bd63 100644
--- a/src/process.c
+++ b/src/process.c
@@ -146,13 +146,13 @@ Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs;
146Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime; 146Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime;
147Lisp_Object QCname, QCtype; 147Lisp_Object QCname, QCtype;
148 148
149/* Non-zero if keyboard input is on hold, zero otherwise. */ 149/* True if keyboard input is on hold, zero otherwise. */
150 150
151static int kbd_is_on_hold; 151static bool kbd_is_on_hold;
152 152
153/* Nonzero means don't run process sentinels. This is used 153/* Nonzero means don't run process sentinels. This is used
154 when exiting. */ 154 when exiting. */
155int inhibit_sentinels; 155bool inhibit_sentinels;
156 156
157#ifdef subprocesses 157#ifdef subprocesses
158 158
@@ -234,9 +234,9 @@ static EMACS_INT update_tick;
234 234
235static int process_output_delay_count; 235static int process_output_delay_count;
236 236
237/* Non-zero if any process has non-nil read_output_skip. */ 237/* True if any process has non-nil read_output_skip. */
238 238
239static int process_output_skip; 239static bool process_output_skip;
240 240
241#else 241#else
242#define process_output_delay_count 0 242#define process_output_delay_count 0
@@ -244,7 +244,7 @@ static int process_output_skip;
244 244
245static void create_process (Lisp_Object, char **, Lisp_Object); 245static void create_process (Lisp_Object, char **, Lisp_Object);
246#ifdef USABLE_SIGIO 246#ifdef USABLE_SIGIO
247static int keyboard_bit_set (SELECT_TYPE *); 247static bool keyboard_bit_set (SELECT_TYPE *);
248#endif 248#endif
249static void deactivate_process (Lisp_Object); 249static void deactivate_process (Lisp_Object);
250static void status_notify (struct Lisp_Process *); 250static void status_notify (struct Lisp_Process *);
@@ -527,7 +527,7 @@ status_convert (int w)
527 and store them individually through the three pointers. */ 527 and store them individually through the three pointers. */
528 528
529static void 529static void
530decode_status (Lisp_Object l, Lisp_Object *symbol, int *code, int *coredump) 530decode_status (Lisp_Object l, Lisp_Object *symbol, int *code, bool *coredump)
531{ 531{
532 Lisp_Object tem; 532 Lisp_Object tem;
533 533
@@ -554,7 +554,8 @@ status_message (struct Lisp_Process *p)
554{ 554{
555 Lisp_Object status = p->status; 555 Lisp_Object status = p->status;
556 Lisp_Object symbol; 556 Lisp_Object symbol;
557 int code, coredump; 557 int code;
558 bool coredump;
558 Lisp_Object string, string2; 559 Lisp_Object string, string2;
559 560
560 decode_status (status, &symbol, &code, &coredump); 561 decode_status (status, &symbol, &code, &coredump);
@@ -1579,7 +1580,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1579 sigset_t blocked; 1580 sigset_t blocked;
1580 /* Use volatile to protect variables from being clobbered by vfork. */ 1581 /* Use volatile to protect variables from being clobbered by vfork. */
1581 volatile int forkin, forkout; 1582 volatile int forkin, forkout;
1582 volatile int pty_flag = 0; 1583 volatile bool pty_flag = 0;
1583 volatile Lisp_Object lisp_pty_name = Qnil; 1584 volatile Lisp_Object lisp_pty_name = Qnil;
1584 volatile Lisp_Object encoded_current_dir; 1585 volatile Lisp_Object encoded_current_dir;
1585 1586
@@ -1871,7 +1872,7 @@ void
1871create_pty (Lisp_Object process) 1872create_pty (Lisp_Object process)
1872{ 1873{
1873 int inchannel, outchannel; 1874 int inchannel, outchannel;
1874 int pty_flag = 0; 1875 bool pty_flag = 0;
1875 1876
1876 inchannel = outchannel = -1; 1877 inchannel = outchannel = -1;
1877 1878
@@ -2819,8 +2820,9 @@ usage: (make-network-process &rest ARGS) */)
2819 Lisp_Object tem; 2820 Lisp_Object tem;
2820 Lisp_Object name, buffer, host, service, address; 2821 Lisp_Object name, buffer, host, service, address;
2821 Lisp_Object filter, sentinel; 2822 Lisp_Object filter, sentinel;
2822 int is_non_blocking_client = 0; 2823 bool is_non_blocking_client = 0;
2823 int is_server = 0, backlog = 5; 2824 bool is_server = 0;
2825 int backlog = 5;
2824 int socktype; 2826 int socktype;
2825 int family = -1; 2827 int family = -1;
2826 2828
@@ -3497,7 +3499,7 @@ format; see the description of ADDRESS in `make-network-process'. */)
3497 struct ifreq *ifreq; 3499 struct ifreq *ifreq;
3498 void *buf = NULL; 3500 void *buf = NULL;
3499 ptrdiff_t buf_size = 512; 3501 ptrdiff_t buf_size = 512;
3500 int s, i; 3502 int s;
3501 Lisp_Object res; 3503 Lisp_Object res;
3502 3504
3503 s = socket (AF_INET, SOCK_STREAM, 0); 3505 s = socket (AF_INET, SOCK_STREAM, 0);
@@ -3535,7 +3537,6 @@ format; see the description of ADDRESS in `make-network-process'. */)
3535 int len = sizeof (*ifreq); 3537 int len = sizeof (*ifreq);
3536#endif 3538#endif
3537 char namebuf[sizeof (ifq->ifr_name) + 1]; 3539 char namebuf[sizeof (ifq->ifr_name) + 1];
3538 i += len;
3539 ifreq = (struct ifreq *) ((char *) ifreq + len); 3540 ifreq = (struct ifreq *) ((char *) ifreq + len);
3540 3541
3541 if (ifq->ifr_addr.sa_family != AF_INET) 3542 if (ifq->ifr_addr.sa_family != AF_INET)
@@ -3645,7 +3646,7 @@ FLAGS is the current flags of the interface. */)
3645 Lisp_Object res = Qnil; 3646 Lisp_Object res = Qnil;
3646 Lisp_Object elt; 3647 Lisp_Object elt;
3647 int s; 3648 int s;
3648 int any = 0; 3649 bool any = 0;
3649#if (! (defined SIOCGIFHWADDR && defined HAVE_STRUCT_IFREQ_IFR_HWADDR) \ 3650#if (! (defined SIOCGIFHWADDR && defined HAVE_STRUCT_IFREQ_IFR_HWADDR) \
3650 && defined HAVE_GETIFADDRS && defined LLADDR) 3651 && defined HAVE_GETIFADDRS && defined LLADDR)
3651 struct ifaddrs *ifap; 3652 struct ifaddrs *ifap;
@@ -3931,7 +3932,7 @@ Return non-nil if we received any output before the timeout expired. */)
3931 3932
3932/* Accept a connection for server process SERVER on CHANNEL. */ 3933/* Accept a connection for server process SERVER on CHANNEL. */
3933 3934
3934static int connect_counter = 0; 3935static EMACS_INT connect_counter = 0;
3935 3936
3936static void 3937static void
3937server_accept_connection (Lisp_Object server, int channel) 3938server_accept_connection (Lisp_Object server, int channel)
@@ -4186,7 +4187,7 @@ wait_reading_process_output_1 (void)
4186 process. The return value is true if we read some input from 4187 process. The return value is true if we read some input from
4187 that process. 4188 that process.
4188 4189
4189 If JUST_WAIT_PROC is non-nil, handle only output from WAIT_PROC 4190 If JUST_WAIT_PROC is nonzero, handle only output from WAIT_PROC
4190 (suspending output from other processes). A negative value 4191 (suspending output from other processes). A negative value
4191 means don't run any timers either. 4192 means don't run any timers either.
4192 4193
@@ -4194,22 +4195,23 @@ wait_reading_process_output_1 (void)
4194 received input from that process before the timeout elapsed. 4195 received input from that process before the timeout elapsed.
4195 Otherwise, return true if we received input from any process. */ 4196 Otherwise, return true if we received input from any process. */
4196 4197
4197int 4198bool
4198wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, 4199wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4199 bool do_display, 4200 bool do_display,
4200 Lisp_Object wait_for_cell, 4201 Lisp_Object wait_for_cell,
4201 struct Lisp_Process *wait_proc, int just_wait_proc) 4202 struct Lisp_Process *wait_proc, int just_wait_proc)
4202{ 4203{
4203 register int channel, nfds; 4204 int channel, nfds;
4204 SELECT_TYPE Available; 4205 SELECT_TYPE Available;
4205 SELECT_TYPE Writeok; 4206 SELECT_TYPE Writeok;
4206 int check_write; 4207 bool check_write;
4207 int check_delay, no_avail; 4208 int check_delay;
4209 bool no_avail;
4208 int xerrno; 4210 int xerrno;
4209 Lisp_Object proc; 4211 Lisp_Object proc;
4210 EMACS_TIME timeout, end_time; 4212 EMACS_TIME timeout, end_time;
4211 int wait_channel = -1; 4213 int wait_channel = -1;
4212 int got_some_input = 0; 4214 bool got_some_input = 0;
4213 ptrdiff_t count = SPECPDL_INDEX (); 4215 ptrdiff_t count = SPECPDL_INDEX ();
4214 4216
4215 FD_ZERO (&Available); 4217 FD_ZERO (&Available);
@@ -4246,7 +4248,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4246 4248
4247 while (1) 4249 while (1)
4248 { 4250 {
4249 int timeout_reduced_for_timers = 0; 4251 bool timeout_reduced_for_timers = 0;
4250 4252
4251 /* If calling from keyboard input, do not quit 4253 /* If calling from keyboard input, do not quit
4252 since we want to return C-g as an input character. 4254 since we want to return C-g as an input character.
@@ -4624,7 +4626,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4624 unsigned old_timers_run = timers_run; 4626 unsigned old_timers_run = timers_run;
4625 struct buffer *old_buffer = current_buffer; 4627 struct buffer *old_buffer = current_buffer;
4626 Lisp_Object old_window = selected_window; 4628 Lisp_Object old_window = selected_window;
4627 int leave = 0; 4629 bool leave = 0;
4628 4630
4629 if (detect_input_pending_run_timers (do_display)) 4631 if (detect_input_pending_run_timers (do_display))
4630 { 4632 {
@@ -4945,7 +4947,7 @@ read_process_output (Lisp_Object proc, register int channel)
4945 else 4947 else
4946#endif 4948#endif
4947 { 4949 {
4948 int buffered = 0 <= proc_buffered_char[channel]; 4950 bool buffered = 0 <= proc_buffered_char[channel];
4949 if (buffered) 4951 if (buffered)
4950 { 4952 {
4951 chars[carryover] = proc_buffered_char[channel]; 4953 chars[carryover] = proc_buffered_char[channel];
@@ -5261,7 +5263,7 @@ read_process_output (Lisp_Object proc, register int channel)
5261 5263
5262static void 5264static void
5263write_queue_push (struct Lisp_Process *p, Lisp_Object input_obj, 5265write_queue_push (struct Lisp_Process *p, Lisp_Object input_obj,
5264 const char *buf, ptrdiff_t len, int front) 5266 const char *buf, ptrdiff_t len, bool front)
5265{ 5267{
5266 ptrdiff_t offset; 5268 ptrdiff_t offset;
5267 Lisp_Object entry, obj; 5269 Lisp_Object entry, obj;
@@ -5286,10 +5288,10 @@ write_queue_push (struct Lisp_Process *p, Lisp_Object input_obj,
5286} 5288}
5287 5289
5288/* Remove the first element in the write_queue of process P, put its 5290/* Remove the first element in the write_queue of process P, put its
5289 contents in OBJ, BUF and LEN, and return non-zero. If the 5291 contents in OBJ, BUF and LEN, and return true. If the
5290 write_queue is empty, return zero. */ 5292 write_queue is empty, return false. */
5291 5293
5292static int 5294static bool
5293write_queue_pop (struct Lisp_Process *p, Lisp_Object *obj, 5295write_queue_pop (struct Lisp_Process *p, Lisp_Object *obj,
5294 const char **buf, ptrdiff_t *len) 5296 const char **buf, ptrdiff_t *len)
5295{ 5297{
@@ -5650,7 +5652,7 @@ return t unconditionally. */)
5650 If CURRENT_GROUP is lambda, that means send to the process group 5652 If CURRENT_GROUP is lambda, that means send to the process group
5651 that currently owns the terminal, but only if it is NOT the shell itself. 5653 that currently owns the terminal, but only if it is NOT the shell itself.
5652 5654
5653 If NOMSG is zero, insert signal-announcements into process's buffers 5655 If NOMSG is false, insert signal-announcements into process's buffers
5654 right away. 5656 right away.
5655 5657
5656 If we can, we try to signal PROCESS by sending control characters 5658 If we can, we try to signal PROCESS by sending control characters
@@ -5659,12 +5661,12 @@ return t unconditionally. */)
5659 5661
5660static void 5662static void
5661process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group, 5663process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
5662 int nomsg) 5664 bool nomsg)
5663{ 5665{
5664 Lisp_Object proc; 5666 Lisp_Object proc;
5665 register struct Lisp_Process *p; 5667 struct Lisp_Process *p;
5666 pid_t gid; 5668 pid_t gid;
5667 int no_pgrp = 0; 5669 bool no_pgrp = 0;
5668 5670
5669 proc = get_process (process); 5671 proc = get_process (process);
5670 p = XPROCESS (proc); 5672 p = XPROCESS (proc);
@@ -6161,7 +6163,7 @@ handle_child_signal (int sig)
6161 /* If process has terminated, stop waiting for its output. */ 6163 /* If process has terminated, stop waiting for its output. */
6162 if (WIFSIGNALED (status) || WIFEXITED (status)) 6164 if (WIFSIGNALED (status) || WIFEXITED (status))
6163 { 6165 {
6164 int clear_desc_flag = 0; 6166 bool clear_desc_flag = 0;
6165 p->alive = 0; 6167 p->alive = 0;
6166 if (p->infd >= 0) 6168 if (p->infd >= 0)
6167 clear_desc_flag = 1; 6169 clear_desc_flag = 1;
@@ -6504,10 +6506,10 @@ delete_gpm_wait_descriptor (int desc)
6504 6506
6505# ifdef USABLE_SIGIO 6507# ifdef USABLE_SIGIO
6506 6508
6507/* Return nonzero if *MASK has a bit set 6509/* Return true if *MASK has a bit set
6508 that corresponds to one of the keyboard input descriptors. */ 6510 that corresponds to one of the keyboard input descriptors. */
6509 6511
6510static int 6512static bool
6511keyboard_bit_set (fd_set *mask) 6513keyboard_bit_set (fd_set *mask)
6512{ 6514{
6513 int fd; 6515 int fd;
@@ -6557,7 +6559,7 @@ extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
6557 6559
6558 Return true if we received input from any process. */ 6560 Return true if we received input from any process. */
6559 6561
6560int 6562bool
6561wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, 6563wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
6562 bool do_display, 6564 bool do_display,
6563 Lisp_Object wait_for_cell, 6565 Lisp_Object wait_for_cell,
@@ -6589,7 +6591,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
6589 6591
6590 while (1) 6592 while (1)
6591 { 6593 {
6592 int timeout_reduced_for_timers = 0; 6594 bool timeout_reduced_for_timers = 0;
6593 SELECT_TYPE waitchannels; 6595 SELECT_TYPE waitchannels;
6594 int xerrno; 6596 int xerrno;
6595 6597
@@ -6940,9 +6942,9 @@ unhold_keyboard_input (void)
6940 kbd_is_on_hold = 0; 6942 kbd_is_on_hold = 0;
6941} 6943}
6942 6944
6943/* Return non-zero if keyboard input is on hold, zero otherwise. */ 6945/* Return true if keyboard input is on hold, zero otherwise. */
6944 6946
6945int 6947bool
6946kbd_on_hold_p (void) 6948kbd_on_hold_p (void)
6947{ 6949{
6948 return kbd_is_on_hold; 6950 return kbd_is_on_hold;
diff --git a/src/process.h b/src/process.h
index a003ffa147f..765e5d82567 100644
--- a/src/process.h
+++ b/src/process.h
@@ -159,7 +159,7 @@ struct Lisp_Process
159 gnutls_anon_client_credentials_t gnutls_anon_cred; 159 gnutls_anon_client_credentials_t gnutls_anon_cred;
160 int gnutls_log_level; 160 int gnutls_log_level;
161 int gnutls_handshakes_tried; 161 int gnutls_handshakes_tried;
162 int gnutls_p; 162 unsigned int gnutls_p : 1;
163#endif 163#endif
164}; 164};
165 165
@@ -185,9 +185,9 @@ pset_gnutls_cred_type (struct Lisp_Process *p, Lisp_Object val)
185} 185}
186#endif 186#endif
187 187
188/* Nonzero means don't run process sentinels. This is used 188/* True means don't run process sentinels. This is used
189 when exiting. */ 189 when exiting. */
190extern int inhibit_sentinels; 190extern bool inhibit_sentinels;
191 191
192extern Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname; 192extern Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname;
193extern Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime; 193extern Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime;
@@ -209,7 +209,7 @@ extern Lisp_Object system_process_attributes (Lisp_Object);
209 209
210extern void hold_keyboard_input (void); 210extern void hold_keyboard_input (void);
211extern void unhold_keyboard_input (void); 211extern void unhold_keyboard_input (void);
212extern int kbd_on_hold_p (void); 212extern bool kbd_on_hold_p (void);
213 213
214typedef void (*fd_callback) (int fd, void *data); 214typedef void (*fd_callback) (int fd, void *data);
215 215
diff --git a/src/region-cache.c b/src/region-cache.c
index 14e6982cd9a..452a5b3a065 100644
--- a/src/region-cache.c
+++ b/src/region-cache.c
@@ -695,8 +695,9 @@ know_region_cache (struct buffer *buf, struct region_cache *c,
695 695
696/* Interface: using the cache. */ 696/* Interface: using the cache. */
697 697
698/* Return true if the text immediately after POS in BUF is known, for 698/* Return the value for the text immediately after POS in BUF if the value
699 the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest 699 is known, for the purposes of CACHE, and return zero otherwise.
700 If NEXT is non-zero, set *NEXT to the nearest
700 position after POS where the knowledge changes. */ 701 position after POS where the knowledge changes. */
701int 702int
702region_cache_forward (struct buffer *buf, struct region_cache *c, 703region_cache_forward (struct buffer *buf, struct region_cache *c,
@@ -732,8 +733,9 @@ region_cache_forward (struct buffer *buf, struct region_cache *c,
732 } 733 }
733} 734}
734 735
735/* Return true if the text immediately before POS in BUF is known, for 736/* Return the value for the text immediately before POS in BUF if the
736 the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest 737 value is known, for the purposes of CACHE, and return zero
738 otherwise. If NEXT is non-zero, set *NEXT to the nearest
737 position before POS where the knowledge changes. */ 739 position before POS where the knowledge changes. */
738int region_cache_backward (struct buffer *buf, struct region_cache *c, 740int region_cache_backward (struct buffer *buf, struct region_cache *c,
739 ptrdiff_t pos, ptrdiff_t *next) 741 ptrdiff_t pos, ptrdiff_t *next)
diff --git a/src/scroll.c b/src/scroll.c
index 9e11feb64d4..037e338c696 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -246,9 +246,8 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
246 struct matrix_elt *p; 246 struct matrix_elt *p;
247 int i, j, k; 247 int i, j, k;
248 248
249 /* Set to 1 if we have set a terminal window with 249 /* True if we have set a terminal window with set_terminal_window. */
250 set_terminal_window. It's unsigned to work around GCC bug 48228. */ 250 bool terminal_window_p = 0;
251 unsigned int terminal_window_p = 0;
252 251
253 /* A queue for line insertions to be done. */ 252 /* A queue for line insertions to be done. */
254 struct queue { int count, pos; }; 253 struct queue { int count, pos; };
@@ -657,18 +656,16 @@ do_direct_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
657 alloca (window_size * sizeof *queue_start); 656 alloca (window_size * sizeof *queue_start);
658 struct alt_queue *queue = queue_start; 657 struct alt_queue *queue = queue_start;
659 658
660 /* Set to 1 if a terminal window has been set with 659 /* True if a terminal window has been set with set_terminal_window. */
661 set_terminal_window: */ 660 bool terminal_window_p = 0;
662 int terminal_window_p = 0;
663 661
664 /* A nonzero value of write_follows indicates that a write has been 662 /* If true, a write has been selected, allowing either an insert or a
665 selected, allowing either an insert or a delete to be selected 663 delete to be selected next. If false, a delete cannot be selected
666 next. When write_follows is zero, a delete cannot be selected
667 unless j < i, and an insert cannot be selected unless i < j. 664 unless j < i, and an insert cannot be selected unless i < j.
668 This corresponds to a similar restriction (with the ordering 665 This corresponds to a similar restriction (with the ordering
669 reversed) in calculate_direct_scrolling, which is intended to 666 reversed) in calculate_direct_scrolling, which is intended to
670 ensure that lines marked as inserted will be blank. */ 667 ensure that lines marked as inserted will be blank. */
671 int write_follows_p = 1; 668 bool write_follows_p = 1;
672 669
673 /* For each row in the new matrix what row of the old matrix it is. */ 670 /* For each row in the new matrix what row of the old matrix it is. */
674 int *copy_from = alloca (window_size * sizeof *copy_from); 671 int *copy_from = alloca (window_size * sizeof *copy_from);
diff --git a/src/search.c b/src/search.c
index 090965ead3b..c5ac7d494dc 100644
--- a/src/search.c
+++ b/src/search.c
@@ -49,8 +49,8 @@ struct regexp_cache
49 Lisp_Object syntax_table; 49 Lisp_Object syntax_table;
50 struct re_pattern_buffer buf; 50 struct re_pattern_buffer buf;
51 char fastmap[0400]; 51 char fastmap[0400];
52 /* Nonzero means regexp was compiled to do full POSIX backtracking. */ 52 /* True means regexp was compiled to do full POSIX backtracking. */
53 char posix; 53 bool posix;
54}; 54};
55 55
56/* The instances of that struct. */ 56/* The instances of that struct. */
@@ -100,7 +100,7 @@ static EMACS_INT boyer_moore (EMACS_INT, unsigned char *, ptrdiff_t,
100 ptrdiff_t, int); 100 ptrdiff_t, int);
101static EMACS_INT search_buffer (Lisp_Object, ptrdiff_t, ptrdiff_t, 101static EMACS_INT search_buffer (Lisp_Object, ptrdiff_t, ptrdiff_t,
102 ptrdiff_t, ptrdiff_t, EMACS_INT, int, 102 ptrdiff_t, ptrdiff_t, EMACS_INT, int,
103 Lisp_Object, Lisp_Object, int); 103 Lisp_Object, Lisp_Object, bool);
104 104
105static _Noreturn void 105static _Noreturn void
106matcher_overflow (void) 106matcher_overflow (void)
@@ -112,13 +112,14 @@ matcher_overflow (void)
112 PATTERN is the pattern to compile. 112 PATTERN is the pattern to compile.
113 CP is the place to put the result. 113 CP is the place to put the result.
114 TRANSLATE is a translation table for ignoring case, or nil for none. 114 TRANSLATE is a translation table for ignoring case, or nil for none.
115 POSIX is nonzero if we want full backtracking (POSIX style) 115 POSIX is true if we want full backtracking (POSIX style) for this pattern.
116 for this pattern. 0 means backtrack only enough to get a valid match. 116 False means backtrack only enough to get a valid match.
117 117
118 The behavior also depends on Vsearch_spaces_regexp. */ 118 The behavior also depends on Vsearch_spaces_regexp. */
119 119
120static void 120static void
121compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object translate, int posix) 121compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern,
122 Lisp_Object translate, bool posix)
122{ 123{
123 char *val; 124 char *val;
124 reg_syntax_t old; 125 reg_syntax_t old;
@@ -205,12 +206,12 @@ clear_regexp_cache (void)
205 values that will result from matching this pattern. 206 values that will result from matching this pattern.
206 If it is 0, we should compile the pattern not to record any 207 If it is 0, we should compile the pattern not to record any
207 subexpression bounds. 208 subexpression bounds.
208 POSIX is nonzero if we want full backtracking (POSIX style) 209 POSIX is true if we want full backtracking (POSIX style) for this pattern.
209 for this pattern. 0 means backtrack only enough to get a valid match. */ 210 False means backtrack only enough to get a valid match. */
210 211
211struct re_pattern_buffer * 212struct re_pattern_buffer *
212compile_pattern (Lisp_Object pattern, struct re_registers *regp, 213compile_pattern (Lisp_Object pattern, struct re_registers *regp,
213 Lisp_Object translate, int posix, bool multibyte) 214 Lisp_Object translate, bool posix, bool multibyte)
214{ 215{
215 struct regexp_cache *cp, **cpp; 216 struct regexp_cache *cp, **cpp;
216 217
@@ -267,7 +268,7 @@ compile_pattern (Lisp_Object pattern, struct re_registers *regp,
267 268
268 269
269static Lisp_Object 270static Lisp_Object
270looking_at_1 (Lisp_Object string, int posix) 271looking_at_1 (Lisp_Object string, bool posix)
271{ 272{
272 Lisp_Object val; 273 Lisp_Object val;
273 unsigned char *p1, *p2; 274 unsigned char *p1, *p2;
@@ -365,7 +366,8 @@ data if you want to preserve them. */)
365} 366}
366 367
367static Lisp_Object 368static Lisp_Object
368string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, int posix) 369string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start,
370 bool posix)
369{ 371{
370 ptrdiff_t val; 372 ptrdiff_t val;
371 struct re_pattern_buffer *bufp; 373 struct re_pattern_buffer *bufp;
@@ -621,7 +623,7 @@ newline_cache_on_off (struct buffer *buf)
621} 623}
622 624
623 625
624/* Search for COUNT newlines between START and END. 626/* Search for COUNT newlines between START/START_BYTE and END/END_BYTE.
625 627
626 If COUNT is positive, search forwards; END must be >= START. 628 If COUNT is positive, search forwards; END must be >= START.
627 If COUNT is negative, search backwards for the -COUNTth instance; 629 If COUNT is negative, search backwards for the -COUNTth instance;
@@ -645,11 +647,11 @@ newline_cache_on_off (struct buffer *buf)
645 except when inside redisplay. */ 647 except when inside redisplay. */
646 648
647ptrdiff_t 649ptrdiff_t
648find_newline (ptrdiff_t start, ptrdiff_t end, ptrdiff_t count, 650find_newline (ptrdiff_t start, ptrdiff_t start_byte, ptrdiff_t end,
649 ptrdiff_t *shortage, ptrdiff_t *bytepos, bool allow_quit) 651 ptrdiff_t end_byte, ptrdiff_t count, ptrdiff_t *shortage,
652 ptrdiff_t *bytepos, bool allow_quit)
650{ 653{
651 struct region_cache *newline_cache; 654 struct region_cache *newline_cache;
652 ptrdiff_t start_byte = -1, end_byte = -1;
653 int direction; 655 int direction;
654 656
655 if (count > 0) 657 if (count > 0)
@@ -706,7 +708,7 @@ find_newline (ptrdiff_t start, ptrdiff_t end, ptrdiff_t count,
706 next_change is the position of the next known region. */ 708 next_change is the position of the next known region. */
707 ceiling_byte = min (CHAR_TO_BYTE (next_change) - 1, ceiling_byte); 709 ceiling_byte = min (CHAR_TO_BYTE (next_change) - 1, ceiling_byte);
708 } 710 }
709 else 711 else if (start_byte == -1)
710 start_byte = CHAR_TO_BYTE (start); 712 start_byte = CHAR_TO_BYTE (start);
711 713
712 /* The dumb loop can only scan text stored in contiguous 714 /* The dumb loop can only scan text stored in contiguous
@@ -783,7 +785,7 @@ find_newline (ptrdiff_t start, ptrdiff_t end, ptrdiff_t count,
783 next_change is the position of the next known region. */ 785 next_change is the position of the next known region. */
784 ceiling_byte = max (CHAR_TO_BYTE (next_change), ceiling_byte); 786 ceiling_byte = max (CHAR_TO_BYTE (next_change), ceiling_byte);
785 } 787 }
786 else 788 else if (start_byte == -1)
787 start_byte = CHAR_TO_BYTE (start); 789 start_byte = CHAR_TO_BYTE (start);
788 790
789 /* Stop scanning before the gap. */ 791 /* Stop scanning before the gap. */
@@ -944,9 +946,10 @@ scan_newline (ptrdiff_t start, ptrdiff_t start_byte,
944/* Like find_newline, but doesn't allow QUITting and doesn't return 946/* Like find_newline, but doesn't allow QUITting and doesn't return
945 SHORTAGE. */ 947 SHORTAGE. */
946ptrdiff_t 948ptrdiff_t
947find_newline_no_quit (ptrdiff_t from, ptrdiff_t cnt, ptrdiff_t *bytepos) 949find_newline_no_quit (ptrdiff_t from, ptrdiff_t frombyte,
950 ptrdiff_t cnt, ptrdiff_t *bytepos)
948{ 951{
949 return find_newline (from, 0, cnt, NULL, bytepos, 0); 952 return find_newline (from, frombyte, 0, -1, cnt, NULL, bytepos, 0);
950} 953}
951 954
952/* Like find_newline, but returns position before the newline, not 955/* Like find_newline, but returns position before the newline, not
@@ -958,7 +961,7 @@ find_before_next_newline (ptrdiff_t from, ptrdiff_t to,
958 ptrdiff_t cnt, ptrdiff_t *bytepos) 961 ptrdiff_t cnt, ptrdiff_t *bytepos)
959{ 962{
960 ptrdiff_t shortage; 963 ptrdiff_t shortage;
961 ptrdiff_t pos = find_newline (from, to, cnt, &shortage, bytepos, 1); 964 ptrdiff_t pos = find_newline (from, -1, to, -1, cnt, &shortage, bytepos, 1);
962 965
963 if (shortage == 0) 966 if (shortage == 0)
964 { 967 {
@@ -974,9 +977,9 @@ find_before_next_newline (ptrdiff_t from, ptrdiff_t to,
974 977
975static Lisp_Object 978static Lisp_Object
976search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, 979search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
977 Lisp_Object count, int direction, int RE, int posix) 980 Lisp_Object count, int direction, int RE, bool posix)
978{ 981{
979 register EMACS_INT np; 982 EMACS_INT np;
980 EMACS_INT lim; 983 EMACS_INT lim;
981 ptrdiff_t lim_byte; 984 ptrdiff_t lim_byte;
982 EMACS_INT n = direction; 985 EMACS_INT n = direction;
@@ -1046,9 +1049,9 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
1046 return make_number (np); 1049 return make_number (np);
1047} 1050}
1048 1051
1049/* Return 1 if REGEXP it matches just one constant string. */ 1052/* Return true if REGEXP it matches just one constant string. */
1050 1053
1051static int 1054static bool
1052trivial_regexp_p (Lisp_Object regexp) 1055trivial_regexp_p (Lisp_Object regexp)
1053{ 1056{
1054 ptrdiff_t len = SBYTES (regexp); 1057 ptrdiff_t len = SBYTES (regexp);
@@ -1117,7 +1120,7 @@ static struct re_registers search_regs_1;
1117static EMACS_INT 1120static EMACS_INT
1118search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, 1121search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
1119 ptrdiff_t lim, ptrdiff_t lim_byte, EMACS_INT n, 1122 ptrdiff_t lim, ptrdiff_t lim_byte, EMACS_INT n,
1120 int RE, Lisp_Object trt, Lisp_Object inverse_trt, int posix) 1123 int RE, Lisp_Object trt, Lisp_Object inverse_trt, bool posix)
1121{ 1124{
1122 ptrdiff_t len = SCHARS (string); 1125 ptrdiff_t len = SCHARS (string);
1123 ptrdiff_t len_byte = SBYTES (string); 1126 ptrdiff_t len_byte = SBYTES (string);
@@ -1272,7 +1275,7 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
1272 /* Set to positive if we find a non-ASCII char that need 1275 /* Set to positive if we find a non-ASCII char that need
1273 translation. Otherwise set to zero later. */ 1276 translation. Otherwise set to zero later. */
1274 int char_base = -1; 1277 int char_base = -1;
1275 int boyer_moore_ok = 1; 1278 bool boyer_moore_ok = 1;
1276 1279
1277 /* MULTIBYTE says whether the text to be searched is multibyte. 1280 /* MULTIBYTE says whether the text to be searched is multibyte.
1278 We must convert PATTERN to match that, or we will not really 1281 We must convert PATTERN to match that, or we will not really
@@ -2281,12 +2284,12 @@ since only regular expressions have distinguished subexpressions. */)
2281 (Lisp_Object newtext, Lisp_Object fixedcase, Lisp_Object literal, Lisp_Object string, Lisp_Object subexp) 2284 (Lisp_Object newtext, Lisp_Object fixedcase, Lisp_Object literal, Lisp_Object string, Lisp_Object subexp)
2282{ 2285{
2283 enum { nochange, all_caps, cap_initial } case_action; 2286 enum { nochange, all_caps, cap_initial } case_action;
2284 register ptrdiff_t pos, pos_byte; 2287 ptrdiff_t pos, pos_byte;
2285 int some_multiletter_word; 2288 bool some_multiletter_word;
2286 int some_lowercase; 2289 bool some_lowercase;
2287 int some_uppercase; 2290 bool some_uppercase;
2288 int some_nonuppercase_initial; 2291 bool some_nonuppercase_initial;
2289 register int c, prevc; 2292 int c, prevc;
2290 ptrdiff_t sub; 2293 ptrdiff_t sub;
2291 ptrdiff_t opoint, newpoint; 2294 ptrdiff_t opoint, newpoint;
2292 2295
@@ -2431,7 +2434,7 @@ since only regular expressions have distinguished subexpressions. */)
2431 { 2434 {
2432 ptrdiff_t substart = -1; 2435 ptrdiff_t substart = -1;
2433 ptrdiff_t subend = 0; 2436 ptrdiff_t subend = 0;
2434 int delbackslash = 0; 2437 bool delbackslash = 0;
2435 2438
2436 FETCH_STRING_CHAR_ADVANCE (c, newtext, pos, pos_byte); 2439 FETCH_STRING_CHAR_ADVANCE (c, newtext, pos, pos_byte);
2437 2440
@@ -2528,7 +2531,7 @@ since only regular expressions have distinguished subexpressions. */)
2528 ptrdiff_t substed_alloc_size, substed_len; 2531 ptrdiff_t substed_alloc_size, substed_len;
2529 bool buf_multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); 2532 bool buf_multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
2530 bool str_multibyte = STRING_MULTIBYTE (newtext); 2533 bool str_multibyte = STRING_MULTIBYTE (newtext);
2531 int really_changed = 0; 2534 bool really_changed = 0;
2532 2535
2533 substed_alloc_size = ((STRING_BYTES_BOUND - 100) / 2 < length 2536 substed_alloc_size = ((STRING_BYTES_BOUND - 100) / 2 < length
2534 ? STRING_BYTES_BOUND 2537 ? STRING_BYTES_BOUND
@@ -2694,7 +2697,7 @@ since only regular expressions have distinguished subexpressions. */)
2694} 2697}
2695 2698
2696static Lisp_Object 2699static Lisp_Object
2697match_limit (Lisp_Object num, int beginningp) 2700match_limit (Lisp_Object num, bool beginningp)
2698{ 2701{
2699 EMACS_INT n; 2702 EMACS_INT n;
2700 2703
@@ -2967,9 +2970,9 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere. */)
2967 return Qnil; 2970 return Qnil;
2968} 2971}
2969 2972
2970/* If non-zero the match data have been saved in saved_search_regs 2973/* If true the match data have been saved in saved_search_regs
2971 during the execution of a sentinel or filter. */ 2974 during the execution of a sentinel or filter. */
2972static int search_regs_saved; 2975static bool search_regs_saved;
2973static struct re_registers saved_search_regs; 2976static struct re_registers saved_search_regs;
2974static Lisp_Object saved_last_thing_searched; 2977static Lisp_Object saved_last_thing_searched;
2975 2978
@@ -3034,9 +3037,9 @@ DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0,
3034 doc: /* Return a regexp string which matches exactly STRING and nothing else. */) 3037 doc: /* Return a regexp string which matches exactly STRING and nothing else. */)
3035 (Lisp_Object string) 3038 (Lisp_Object string)
3036{ 3039{
3037 register char *in, *out, *end; 3040 char *in, *out, *end;
3038 register char *temp; 3041 char *temp;
3039 int backslashes_added = 0; 3042 ptrdiff_t backslashes_added = 0;
3040 3043
3041 CHECK_STRING (string); 3044 CHECK_STRING (string);
3042 3045
diff --git a/src/xdisp.c b/src/xdisp.c
index 28acbbdb8c0..48fc95a9a34 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -5940,8 +5940,10 @@ pop_it (struct it *it)
5940static void 5940static void
5941back_to_previous_line_start (struct it *it) 5941back_to_previous_line_start (struct it *it)
5942{ 5942{
5943 IT_CHARPOS (*it) = find_newline_no_quit (IT_CHARPOS (*it) - 1, -1, 5943 ptrdiff_t cp = IT_CHARPOS (*it), bp = IT_BYTEPOS (*it);
5944 &IT_BYTEPOS (*it)); 5944
5945 DEC_BOTH (cp, bp);
5946 IT_CHARPOS (*it) = find_newline_no_quit (cp, bp, -1, &IT_BYTEPOS (*it));
5945} 5947}
5946 5948
5947 5949
@@ -6013,7 +6015,8 @@ forward_to_next_line_start (struct it *it, int *skipped_p,
6013 if (!newline_found_p) 6015 if (!newline_found_p)
6014 { 6016 {
6015 ptrdiff_t bytepos, start = IT_CHARPOS (*it); 6017 ptrdiff_t bytepos, start = IT_CHARPOS (*it);
6016 ptrdiff_t limit = find_newline_no_quit (start, 1, &bytepos); 6018 ptrdiff_t limit = find_newline_no_quit (start, IT_BYTEPOS (*it),
6019 1, &bytepos);
6017 Lisp_Object pos; 6020 Lisp_Object pos;
6018 6021
6019 eassert (!STRINGP (it->string)); 6022 eassert (!STRINGP (it->string));
@@ -7473,7 +7476,8 @@ get_visually_first_element (struct it *it)
7473 if (string_p) 7476 if (string_p)
7474 it->bidi_it.charpos = it->bidi_it.bytepos = 0; 7477 it->bidi_it.charpos = it->bidi_it.bytepos = 0;
7475 else 7478 else
7476 it->bidi_it.charpos = find_newline_no_quit (IT_CHARPOS (*it), -1, 7479 it->bidi_it.charpos = find_newline_no_quit (IT_CHARPOS (*it),
7480 IT_BYTEPOS (*it), -1,
7477 &it->bidi_it.bytepos); 7481 &it->bidi_it.bytepos);
7478 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, 1); 7482 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, 1);
7479 do 7483 do
@@ -9121,10 +9125,11 @@ move_it_vertically_backward (struct it *it, int dy)
9121 && IT_CHARPOS (*it) > BEGV 9125 && IT_CHARPOS (*it) > BEGV
9122 && FETCH_BYTE (IT_BYTEPOS (*it) - 1) != '\n') 9126 && FETCH_BYTE (IT_BYTEPOS (*it) - 1) != '\n')
9123 { 9127 {
9124 ptrdiff_t nl_pos = find_newline_no_quit (IT_CHARPOS (*it) - 1, -1, 9128 ptrdiff_t cp = IT_CHARPOS (*it), bp = IT_BYTEPOS (*it);
9125 NULL);
9126 9129
9127 move_it_to (it, nl_pos, -1, -1, -1, MOVE_TO_POS); 9130 DEC_BOTH (cp, bp);
9131 cp = find_newline_no_quit (cp, bp, -1, NULL);
9132 move_it_to (it, cp, -1, -1, -1, MOVE_TO_POS);
9128 } 9133 }
9129 bidi_unshelve_cache (it3data, 1); 9134 bidi_unshelve_cache (it3data, 1);
9130 } 9135 }
@@ -20015,10 +20020,7 @@ See also `bidi-paragraph-direction'. */)
20015 to make sure we are within that paragraph. To that end, find 20020 to make sure we are within that paragraph. To that end, find
20016 the previous non-empty line. */ 20021 the previous non-empty line. */
20017 if (pos >= ZV && pos > BEGV) 20022 if (pos >= ZV && pos > BEGV)
20018 { 20023 DEC_BOTH (pos, bytepos);
20019 pos--;
20020 bytepos = CHAR_TO_BYTE (pos);
20021 }
20022 if (fast_looking_at (build_string ("[\f\t ]*\n"), 20024 if (fast_looking_at (build_string ("[\f\t ]*\n"),
20023 pos, bytepos, ZV, ZV_BYTE, Qnil) > 0) 20025 pos, bytepos, ZV, ZV_BYTE, Qnil) > 0)
20024 { 20026 {