changeset 109798:fe9b13a5f44f

Merge from mainline.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Sun, 15 Aug 2010 22:50:44 +0000
parents c668f865de6b (current diff) 96094f59e6e2 (diff)
children 5cc3b1a56d3e
files lisp/dynamic-setting.el src/unexcoff.c
diffstat 78 files changed, 1890 insertions(+), 1051 deletions(-) [+]
line wrap: on
line diff
--- a/doc/misc/ChangeLog	Wed Aug 11 03:20:07 2010 +0000
+++ b/doc/misc/ChangeLog	Sun Aug 15 22:50:44 2010 +0000
@@ -1,3 +1,7 @@
+2010-08-12  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* cl.texi (Mapping over Sequences): Rename mapc => cl-mapc.
+
 2010-08-09  Jay Belanger  <jay.p.belanger@gmail.com>
 
 	* calc.texi (Customizing Calc): Rearrange description of new
--- a/doc/misc/cl.texi	Wed Aug 11 03:20:07 2010 +0000
+++ b/doc/misc/cl.texi	Sun Aug 15 22:50:44 2010 +0000
@@ -3763,10 +3763,10 @@
 @code{car}s of the advancing pointers.
 @end defun
 
-@defun mapc function seq &rest more-seqs
+@defun cl-mapc function seq &rest more-seqs
 This function is like @code{mapcar*}, except that the values returned
 by @var{function} are ignored and thrown away rather than being
-collected into a list.  The return value of @code{mapc} is @var{seq},
+collected into a list.  The return value of @code{cl-mapc} is @var{seq},
 the first sequence.  This function is more general than the Emacs
 primitive @code{mapc}.
 @end defun
--- a/etc/ChangeLog	Wed Aug 11 03:20:07 2010 +0000
+++ b/etc/ChangeLog	Sun Aug 15 22:50:44 2010 +0000
@@ -1,3 +1,8 @@
+2010-08-14  Eli Zaretskii  <eliz@gnu.org>
+
+	* tutorials/TUTORIAL.he: Use MAQAF instead of hyphen where appropriate.
+	Fix a few typos.
+
 2010-08-08  Ken Brown  <kbrown@cornell.edu>
 
 	* PROBLEMS: Mention problem with Cygwin 1.5.19.
--- a/etc/NEWS	Wed Aug 11 03:20:07 2010 +0000
+++ b/etc/NEWS	Sun Aug 15 22:50:44 2010 +0000
@@ -106,9 +106,12 @@
 
 ** GTK tool bars can be placed on the left/right or top/bottom of the frame.
 The frame-parameter tool-bar-position controls this.  It takes the values
-top, left, tight or bottom.  The Options => Show/Hide menu has entries
+top, left, right or bottom.  The Options => Show/Hide menu has entries
 for this.
 
+** The colors for selected text (the region face) are taken from the GTK
+theme when Emacs is built with GTK.
+
 ** Emacs uses GTK tooltips by default if built with GTK.  You can turn that
 off by customizing x-gtk-use-system-tooltips.
 
@@ -210,6 +213,14 @@
 
 ** Archive Mode has basic support to browse 7z archives.
 
+** ERC changes
+
+*** New vars `erc-autojoin-timing' and `erc-autojoin-delay'.
+If the value of `erc-autojoin-timing' is 'ident, ERC autojoins after a
+successful NickServ identification, or after `erc-autojoin-delay'
+seconds.  The default value, 'ident, means to autojoin immediately
+after connecting.
+
 ** In ido-mode, C-v is no longer bound to ido-toggle-vc.
 The reason is that this interferes with cua-mode.
 
@@ -421,6 +432,7 @@
 
 * Lisp changes in Emacs 24.1
 
+** Syntax tables support a new "comment style c" additionally to style b.
 ** frame-local variables cannot be let-bound any more.
 ** prog-mode is a new major-mode meant to be the parent of programming mode.
 ** define-minor-mode accepts a new keyword :variable.
--- a/etc/compilation.txt	Wed Aug 11 03:20:07 2010 +0000
+++ b/etc/compilation.txt	Sun Aug 15 22:50:44 2010 +0000
@@ -102,42 +102,30 @@
   Scenario: undefined step  # features/cucumber.feature:3
     Given this is undefined # features/cucumber.feature:4
 
-  Scenario: assertion false (Test::Unit)    # features/cucumber.feature:6
-    Given this will generate 'assert false' # features/step_definitions/default_steps.rb:1
+  Scenario: assertion false (Test::Unit)    # foo/bar.feature:6
+    Given this will generate 'assert false' # foo/bar.rb:1
       <false> is not true. (Test::Unit::AssertionFailedError)
-      /home/gusev/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/test/unit/assertions.rb:48:in `assert_block'
-      /home/gusev/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/test/unit/assertions.rb:500:in `_wrap_assertion'
-      /home/gusev/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/test/unit/assertions.rb:46:in `assert_block'
-      /home/gusev/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/test/unit/assertions.rb:63:in `assert'
-      /home/gusev/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/test/unit/assertions.rb:495:in `_wrap_assertion'
-      /home/gusev/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/test/unit/assertions.rb:61:in `assert'
-      ./features/step_definitions/default_steps.rb:2:in `/^this will generate 'assert false'$/'
+      /home/gusev/.rvm/foo/bar.rb:48:in `assert_block'
+      /home/gusev/.rvm/foo/bar.rb:500:in `_wrap_assertion'
       features/cucumber.feature:7:in `Given this will generate 'assert false''
 
-  Scenario: assertion false (RSpec)           # features/cucumber.feature:9
-    Given this will generate 'should be_true' # features/step_definitions/default_steps.rb:5
+  Scenario: assertion false (RSpec)           # foo/bar.feature:9
+    Given this will generate 'should be_true' # foo/bar.rb:5
       expected true to be false (Spec::Expectations::ExpectationNotMetError)
-      ./features/step_definitions/default_steps.rb:6:in `/^this will generate 'should be_true'$/'
-      features/cucumber.feature:10:in `Given this will generate 'should be_true''
+      ./foo/bar/baz.rb:6:in `/^this will generate 'should be_true'$/'
+      foo/bar.feature:10:in `Given this will generate 'should be_true''
 
-  Scenario: backtrace in step definition # features/cucumber.feature:12
-    Given this will generate backtrace   # features/step_definitions/default_steps.rb:9
+  Scenario: backtrace in step definition # foo/bar.feature:12
+    Given this will generate backtrace   # foo/sbar.rb:9
        (RuntimeError)
-      ./features/step_definitions/default_steps.rb:10:in `/^this will generate backtrace$/'
-      features/cucumber.feature:13:in `Given this will generate backtrace'
-
-  Scenario: deeep backtrace in step definition # features/cucumber.feature:15
-    Given this will generate deep backtrace    # features/step_definitions/default_steps.rb:13
-       (RuntimeError)
-      ./features/step_definitions/default_steps.rb:18:in `deep'
-      ./features/step_definitions/default_steps.rb:14:in `/^this will generate deep backtrace$/'
-      features/cucumber.feature:16:in `Given this will generate deep backtrace'
+      ./foo/bar.rb:10:in `/^this will generate backtrace$/'
+      foo/bar.feature:13:in `Given this will generate backtrace'
 
 Failing Scenarios:
-cucumber features/cucumber.feature:6 # Scenario: assertion false (Test::Unit)
-cucumber features/cucumber.feature:9 # Scenario: assertion false (RSpec)
-cucumber features/cucumber.feature:12 # Scenario: backtrace in step definition
-cucumber features/cucumber.feature:15 # Scenario: deeep backtrace in step definition
+cucumber foo/cucumber.feature:6 # Scenario: assertion false (Test::Unit)
+cucumber foo/cucumber.feature:9 # Scenario: assertion false (RSpec)
+cucumber foo/cucumber.feature:12 # Scenario: backtrace in step definition
+cucumber foo/cucumber.feature:15 # Scenario: deeep backtrace in step definition
 
 5 scenarios (4 failed, 1 undefined)
 5 steps (4 failed, 1 undefined)
--- a/etc/tutorials/TUTORIAL.he	Wed Aug 11 03:20:07 2010 +0000
+++ b/etc/tutorials/TUTORIAL.he	Sun Aug 15 22:50:44 2010 +0000
@@ -1,6 +1,6 @@
-שיעור ראשון בשימוש ב-Emacs. זכויות שימוש ראה בסוף המסמך.
+שיעור ראשון בשימוש ב־Emacs. זכויות שימוש ראה בסוף המסמך.
 
-פקודות רבות של Emacs משתמשות במקש CONTROL (לפעמים הוא מסומן ב-CTRL או CTL)
+פקודות רבות של Emacs משתמשות במקש CONTROL (לפעמים הוא מסומן ב־CTRL או CTL)
 או במקש META (לפעמים מסומן EDIT או ALT). במקום לציין את כל השמות האפשריים
 בכל פעם, נשתמש בקיצורים הבאים:
 
@@ -10,13 +10,13 @@
          אם במקלדת אין אף אחד ממקשי META או EDIT או ALT, אפשר להקיש
 	 ולשחרר מקש ESC ואז להקיש <תו>. אנו נכתוב <ESC> עבור מקש ESC.
 
-הערה חשובה: כדי לצאת מ-Emacs יש להקיש C-x C-c (שני תוים, משמאל לימין).
+הערה חשובה: כדי לצאת מ־Emacs יש להקיש C-x C-c (שני תוים, משמאל לימין).
 כדי להפסיק פקודה באמצע ההקשה, יש להקיש C-g.
 המחרוזת ">>" בקצה הימני מסמנת הוראות עבורכם כדי לנסות להשתמש בפקודה כלשהי.
 לדוגמה:
 <<שורות ריקות תתווספנה סביב השורה הבאה ע"י help-with-tutorial>>
 [אמצע העמוד הושאר ריק למטרות לימודיות. הטקסט ממשיך להלן]
->>  הקישו עתה C-v (הצג העמוד הבא) על-מנת להתקדם לעמוד הבא. (קדימה, נסו
+>>  הקישו עתה C-v (הצג העמוד הבא) על־מנת להתקדם לעמוד הבא. (קדימה, נסו
     זאת ע"י לחיצה והחזקה של מקש CONTROL והקשה על v.)
     מעתה והלאה, עליכם לעשות זאת בכל פעם שתסיימו לקרוא את המוצג על המסך.
 
@@ -28,7 +28,7 @@
 (החזיקו מקש META והקישו v או הקישו ‭<ESC>v‬ אם אין במקלדת מקש META
 או EDIT או ALT).
 
->>  נסו עתה כמה פעמים להקיש M-v ואחר-כך C-v.
+>>  נסו עתה כמה פעמים להקיש M-v ואחר־כך C-v.
 
 
 * סיכום עד כאן
@@ -42,24 +42,24 @@
 		כך שהטקסט ליד הסמן יימצא במרכז התצוגה
 		(שימו לב: CONTROL-L ולא CONTROL-1.)
 
->> מצאו את הסמן על-גבי התצוגה וזכרו את הטקסט לידו. לאחר מכן הקישו C-l.
+>> מצאו את הסמן על־גבי התצוגה וזכרו את הטקסט לידו. לאחר מכן הקישו C-l.
    מצאו את הסמן שנית ושימו לב שהוא עדיין ליד אותו הטקסט, אבל עכשיו
    הוא במרכז התצוגה.
    אם תקישו C-l שוב, קטע הטקסט הזה יזוז לקצה העליון של התצוגה. הקישו
    C-l שוב והוא יזוז לתחתית התצוגה.
 
-גם מקשי PageUp ו-PageDn, אם הם קיימים במקלדת שלכם, יכולים לשמש לתנועה
-בעמודים שלמים, אולם השימוש ב-C-v ו-M-v יעיל יותר.
+גם מקשי PageUp ו־PageDn, אם הם קיימים במקלדת שלכם, יכולים לשמש לתנועה
+בעמודים שלמים, אולם השימוש ב־C-v ו־M-v יעיל יותר.
 
 * תנועת סמן בסיסית
 ------------------
 
 תנועה בעמודים שלמים הינה שימושית, אבל כיצד ניתן להגיע למקום ספציפי
-בתוך הטקסט שעל-גבי התצוגה?
+בתוך הטקסט שעל־גבי התצוגה?
 
 ניתן לעשות זאת בכמה דרכים. אפשר למשל להשתמש במקשי החצים, אולם יהיה
 זה יעיל יותר אם תחזיקו את הידיים מעל החלק הסטנדרטי של המקלדת ותשתמשו
-בפקודות C-p, C-b, C-f ו-C-n. פקודות אלו שוות ערך לארבעת מקשי החצים,
+בפקודות C-p, C-b, C-f ו־C-n. פקודות אלו שוות ערך לארבעת מקשי החצים,
 כדלקמן:
 
 			שורה קודמת, C-p
@@ -70,58 +70,58 @@
 				 :
 			השורה הבאה, C-n
 
->> השתמשו במקשי C-n ו-C-p על-מנת להגיע לשורה האמצעית של הדיאגרמה.
-   הקישו C-l כדי למרכז את הדיאגרמה על-גבי התצוגה.
+>> השתמשו במקשי C-n ו־C-p על־מנת להגיע לשורה האמצעית של הדיאגרמה.
+   הקישו C-l כדי למרכז את הדיאגרמה על־גבי התצוגה.
 
 קל יותר לזכור את המקשים הללו באמצעות המלים שהם מייצגים:
-P מ-previous (קודם), N מ-Next (הבא), B מ-Backward (אחורה)
-ו-F מ-Forward (קדימה). מקשי התנועה הבסיסיים הללו ישמשו אתכם כל הזמן.
+P מ־previous (קודם), N מ־Next (הבא), B מ־Backward (אחורה)
+ו־F מ־Forward (קדימה). מקשי התנועה הבסיסיים הללו ישמשו אתכם כל הזמן.
 
 >> הקישו C-n כמה פעמים כדי למקם את הסמן בשורה זו.
 
->> הניעו את הסמן בתוך השורה עם C-f ואחר-כך למעלה עם C-p.
+>> הניעו את הסמן בתוך השורה עם C-f ואחר־כך למעלה עם C-p.
    שימו לב מה עושה C-p כאשר הסמן נמצא באמצע השורה.
 
 כל שורה של טקטס מסתיימת בתו מיוחד הנקרא Newline. תו זה מפריד בין
 השורה לזו שאחריה. (בדרך כלל, השורה האחרונה בקובץ תסתיים אף היא
-ב-Newline, אך Emacs אינו זקוק לכך.)
+ב־Newline, אך Emacs אינו זקוק לכך.)
 
 >> נסו C-b בתחילת שורה. הוא יגרום לסמן לנוע לסוף השורה הקודמת. זאת,
-   משום שהוא נע אחורה וחולף על-פני תו ה-Newline.
+   משום שהוא נע אחורה וחולף על־פני תו ה־Newline.
 
-גם C-f יכול לחלוף על-פני Newline, בדיוק כמו C-b.
+גם C-f יכול לחלוף על־פני Newline, בדיוק כמו C-b.
 
 >> הקישו C-b עוד כמה פעמים כדי לקבל הרגשה היכן נמצא הסמן.
    עתה הקישו C-f מספר פעמים הדרוש לשוב לסוף השורה. ואז הקישו
    C-f עוד פעם אחת כדי לנוע לתחילת השורה הבאה.
 
 כשהסמן יוצא מגבולות הטקסט המוצג, חלקי הטקסט מעבר לחלק המוצג נכנסים
-לתצוגה. לזה קוראים "גלילה". גלילה מאפשרת ל-Emacs להניע את הסמן למקום
+לתצוגה. לזה קוראים "גלילה". גלילה מאפשרת ל־Emacs להניע את הסמן למקום
 כלשהו בטקסט מבלי שהסמן ייעלם מהתצוגה.
 
 >> נסו להניע את הסמן אל מחוץ לתצוגה ע"י הקשת C-n ושימו לב למה שקורה.
 
-אם תנועה תו-תו איטית מדי, תוכלו לנוע מילים שלמות. M-f ‏(META-f) מזיז
+אם תנועה תו־תו איטית מדי, תוכלו לנוע מילים שלמות. M-f ‏(META-f) מזיז
 את הסמן מילה אחת קדימה ואילו M-b זז מילה אחורה.
 
->> הקישו M-f ו-M-b מספר פעמים.
+>> הקישו M-f ו־M-b מספר פעמים.
 
 אם הסמן נמצא באמצע מילה, M-f זז לסוף המילה. אם הסמן נמצא בין שתי מלים,
 M-f עובר את המילה הבאה ונעצר בסופה. M-b פועל באופן דומה בכיוון הפוך.
 
->> הקישו עתה M-f ו-M-b פעמים אחדות, וגם C-f ו-C-b פה ושם כדי שתוכלו
-   להתרשם מהתוצאה של M-f ו-M-b במקומות שונים בתוך ובין המלים.
+>> הקישו עתה M-f ו־M-b פעמים אחדות, וגם C-f ו־C-b פה ושם כדי שתוכלו
+   להתרשם מהתוצאה של M-f ו־M-b במקומות שונים בתוך ובין המלים.
 
-שימו לב להקבלה שבין C-f ו-C-b מצד אחד ו-M-f ו-M-b מהצד השני. לעתים
+שימו לב להקבלה שבין C-f ו־C-b מצד אחד ו־M-f ו־M-b מהצד השני. לעתים
 קרובות מאד מקשים עם META משמשים לפעולות הקשורות ליחידות של שפה (מלים,
 משפטים, פסקאות) ואילו מקשים עם CONTROL פועלים על יחידות בסיסיות שאינן
 תלויות בסוג הטקסט שהינכך עורכים (תוים, שורות, וכד').
 
-ההקבלה הזאת קיימת גם לגבי שורות ומשפטים: C-a ו-C-e נעים לתחילת השורה
-וסופה, בהתאמה, ואילו M-a ו-M-e נעים לתחילת המשפט וסופו.
+ההקבלה הזאת קיימת גם לגבי שורות ומשפטים: C-a ו־C-e נעים לתחילת השורה
+וסופה, בהתאמה, ואילו M-a ו־M-e נעים לתחילת המשפט וסופו.
 
->> נסו עתה שתי הקשות על C-a ואחר-כך שתי הקשות על C-e.
-   נסו שני M-a ואחר-כך שני M-e.
+>> נסו עתה שתי הקשות על C-a ואחר־כך שתי הקשות על C-e.
+   נסו שני M-a ואחר־כך שני M-e.
 
 שימו לב שחזרה על C-a אינה עושה דבר, ואילו כל הקשה חוזרת על M-a מניעה
 את הסמן במשפט נוסף. אמנם אין כאן אנלוגיה מושלמת, אבל התוצאה נראית
@@ -152,20 +152,20 @@
    אלו הן הפקודות הנפוצות ביותר.
 
 שתי פקודות תנועה חשובות אחרת הן ‭M-<‬ ‏(META פחות), אשר נעה לתחילת
-הטקסט, ו-‭M->‬ ‏(META יותר), אשר נעה לסוף הטקסט.
+הטקסט, ו־‭M->‬ ‏(META יותר), אשר נעה לסוף הטקסט.
 
 ברוב המקלדות המקש ">" נמצא מעל הפסיק, לכן כדי להקישו יש צורך ללחוץ
 ולהחזיק מקש Shift. באופן דומה יש ללחוץ על Shift כדי להקיש ‭M-<‬כי
 אחרת היה יוצא M-פסיק.
 
 >> נסו עתה ‭M-<‬ כדי להגיע לתחילת השיעור.
-   אחר-כך הקישו C-v מספר פעמים, עד שתגיעו לכאן.
+   אחר־כך הקישו C-v מספר פעמים, עד שתגיעו לכאן.
 
 >> עכשיו נסו ‭M->‬ כדי להגיע לסוף השיעור.
    לאחר מכן הקישו M-v כמה פעמים כדי לחזור לכאן.
 
 ניתן להזיז את הסמן גם בעזרת מקשי החצים, אם הם קיימים במקלדת שלכם.
-אבל אנחנו ממליצים ללמוד להשתמש ב-C-b, C-f, C-n ו-C-p משלוש סיבות.
+אבל אנחנו ממליצים ללמוד להשתמש ב־C-b, C-f, C-n ו־C-p משלוש סיבות.
 קודם כל, הם יעבדו עם כל מקלדת. שנית, כשתתרגלו לעבוד עם Emacs, תראו
 כי השימוש במקשים אלו מהיר יותר מהשימוש בחצים (מכיון שאין צורך להזיז
 את היד מהחלק העיקרי של המקלדת). ושלישית, כשהמקשים הללו יהפכו להרגל,
@@ -173,7 +173,7 @@
 
 רוב הפקודות של Emacs מקבלות ארגומנט נומרי; עבור רוב הפקודות הארגומנט
 משמש כמונה של מספר החזרות על הפקודה. כדי לספק ארגומנט לפקודה, יש להקיש
-C-u ואחר-כך ספרות, וזאת לפני שמקישים את הפקודה עצמה. עם במקלדת קיים
+C-u ואחר־כך ספרות, וזאת לפני שמקישים את הפקודה עצמה. עם במקלדת קיים
 מקש META (או EDIT או ALT), יש גם אפשרות אחרת לציין ארגומנט נומרי:
 הקישו את הספרות תוך כדי החזקת מקש META. אנו ממליצים על C-u משום שהוא
 יעבוד עם כל מקלדת. הארגומנט הנומרי נקרא גם "ארגומנט קידומת" (prefix
@@ -189,16 +189,16 @@
 משתמשות בו כדגלון -- נוכחותו של הארגומנט, ללא קשר לערכו המספרי, גורמת
 לפקודה להתנהג קצת אחרת.
 
-‏C-v ו-M-v יוצאים מהכלל הזה באופן אחר. כשפקודות אלו מקבלות ארגומנט,
+‏C-v ו־M-v יוצאים מהכלל הזה באופן אחר. כשפקודות אלו מקבלות ארגומנט,
 הן גוללים את התצוגה כמספר הזה של שורות, ולא בדפים. למשל, C-u 8 C-v
-יגלול את התצוגה ב-8 שורות.
+יגלול את התצוגה ב־8 שורות.
 
 >> נסו עתה להקיש C-u 8 C-v.
 
-כתוצאה, התצוגה היתה צריכה לזוז ב-8 שורות. אם ברצונכם לגלול בחזרה,
-אפשר להשיג זאת ע"י מתן ארגומנט ל-M-v.
+כתוצאה, התצוגה היתה צריכה לזוז ב־8 שורות. אם ברצונכם לגלול בחזרה,
+אפשר להשיג זאת ע"י מתן ארגומנט ל־M-v.
 
-אם הפעלתם את Emacs על-גבי מערכת חלונאית כגון X או MS-Windows, אתם
+אם הפעלתם את Emacs על־גבי מערכת חלונאית כגון X או MS-Windows, אתם
 צריכים לראות פס צר וגבוה, ששמו פס גלילה (scroll bar) בצידו של החלון
 של Emacs. (שימו לב שבשני צידי החלון קיימים פסים נוספים. אלה נקראים
 "השוליים" -- "fringes" -- ומשמשים להצגת סימני המשך שורה וסימונים
@@ -231,7 +231,7 @@
 * פקודות מנוטרלות
 -----------------
 
-מספר פקודות ב-Emacs מנוטרלות בכוונה כדי שמשתמשים מתחילים לא יפעילו
+מספר פקודות ב־Emacs מנוטרלות בכוונה כדי שמשתמשים מתחילים לא יפעילו
 אותן בדרך מקרה.
 
 אם תקישו את אחת הפקודות הללו, Emacs יציג הודעה המתארת את הפקודה וישאל
@@ -262,13 +262,13 @@
 >> הקישו C-x 1 ושימו לב שהחלון עם ההסבר על C-f נעלם.
 
 פקודה זו שונה מכל שאר הפקודות שלמדנו עד כה בכך שהיא מכילה שני תוים.
-היא מתחילה עם התו CONTROL-x. פקודות רבות מאד מתחילות ב-CONTROL-x; חלק
+היא מתחילה עם התו CONTROL-x. פקודות רבות מאד מתחילות ב־CONTROL-x; חלק
 גדול מהן עוסקות בחלונות, קבצים, חוצצים ונושאים דומים אחרים. פקודות אלו
 מכילות שנים, שלושה ואפילו ארבעה תוים.
 
 
 * הכנסה ומחיקה
--------------
+--------------
 
 אם ברצונכם להכניס טקסט, פשוט הקישו על המקשים המתאימים. תוים רגילים,
 כגון A, א, 7, * וכד' מתפרשים ע"י Emacs כטקסט ומיד מתווספים לטקסט
@@ -278,15 +278,15 @@
 למחיקת התו האחרון שהקשתם הקישו <DelBack>. המקש שאנו קוראים לו <DelBack>
 יכול להתקרא בשמות שונים -- "Delete", "DEL" או "Backspace". בדרך כלל
 זהו מקש גדול ובולט שנמצא לא הרחק ממקש <Return>, והוא משמש אתכם למחיקת
-התו אחרון גם בתוכניות אחרות, לא רק ב-Emacs.
+התו אחרון גם בתוכניות אחרות, לא רק ב־Emacs.
 
 אם קיים במקלדת שלכם מקש גדול שעליו רשום <Backspace>, אז זהון המקש אשר
-ישמש כ-<DelBack>. גם אם יהיה מקש אחר המסומן ב-"Delete" במקום אחרת זה
-אינו ה-<DelBack> שלכם.
+ישמש כ־<DelBack>. גם אם יהיה מקש אחר המסומן ב־"Delete" במקום אחרת זה
+אינו ה־<DelBack> שלכם.
 
 באופן כללי יותר, <DelBack> מוחק את התו שקודם למיקום הסמן.
 
->> הקישו עתה מספר תוים, ואחר-כך מחקו אותם ע"י הקשות אחדות
+>> הקישו עתה מספר תוים, ואחר־כך מחקו אותם ע"י הקשות אחדות
    על <DelBack>. אל תחששו לשנות את הקובץ הזה -- העותק המקורי
    של השיעור יישאר ללא שינוי. אתם עובדים על העותק האישי שלכם.
 
@@ -297,24 +297,24 @@
 >> הקישו טקסט עד שתגיעו לקצה השורה, ואז תמשיכו להקיש עוד טקסט.
    כתוצאה, תראו שמופיעה שורת המשך.
 
->> עתה הקישו <DelBack> על-מנת למחוק טקסט עד שהשורה תיעשה קצרה מספיק
-   ותתאים לשורה בודדת על-גבי התצוגה. שורת ההמשך תיעלם.
+>> עתה הקישו <DelBack> על־מנת למחוק טקסט עד שהשורה תיעשה קצרה מספיק
+   ותתאים לשורה בודדת על־גבי התצוגה. שורת ההמשך תיעלם.
 
-ניתן למחוק את תו ה-Newline כמו כל תו אחר. מחיקת ה-Newline בין שתי
+ניתן למחוק את תו ה־Newline כמו כל תו אחר. מחיקת ה־Newline בין שתי
 שורות תמזג את השורות לשורה אחת. אם השורה המשולבת תהיה ארוכה מרוחב
 התצוגה, היא תוצג עם שורת המשך.
 
 >> הניעו את הסמן לתחילת השורה והקישו <DelBack>. כתוצאה, השורה תתמזג
    אם קודמתה.
 
->> עתה הקישו <Return> כדי להחזיר את ה-Newline שמחקתם.
+>> עתה הקישו <Return> כדי להחזיר את ה־Newline שמחקתם.
 
-זכרו כי לרוב הפקודות ב-Emacs אפשר לציין מספר חזרות. גם תוי טקסט
+זכרו כי לרוב הפקודות ב־Emacs אפשר לציין מספר חזרות. גם תוי טקסט
 שייכים לקבוצת פקודות זו. חזרה על תו טקסט מכניסה אותו מספר פעמים.
 
->> נסו זאת עכשיו -- הקישו ‪C-u 8 *‬ על-מנת להכניס ********.
+>> נסו זאת עכשיו -- הקישו ‪C-u 8 *‬ על־מנת להכניס ********.
 
-ובכן, למדתם את האופן הבסיסי ביותר להדפיס משהו ב-Emacs ולתקן שגיאות.
+ובכן, למדתם את האופן הבסיסי ביותר להדפיס משהו ב־Emacs ולתקן שגיאות.
 אפשר למחוק גם מלים ואף שורות שלמות. להלן סיכום פקודות המחיקה:
 
 	‏<Delback>	מחק תו שלפני הסמן
@@ -326,9 +326,9 @@
 	‏C-k	        גזור טקסט מהסמן ועד סוף השורה
 	‏M-k	        גזור טקסט עד סוף המשפט הנוכחי.
 
-שימו לב שהיחס בין <Delback> ו-C-d לעומת M-<Delback>‎ ו-M-d ממשיכים את
-ההקבלה שבין C-f ו-M-f (אמנם <Delback> איננו תו בקרה, בוא נזניח את
-הנקודה הזו לעת-עתה). C-k ו-M-k דומים ל-C-e ו-M-e, אם נקביל שורות
+שימו לב שהיחס בין <Delback> ו־C-d לעומת M-<Delback>‎ ו־M-d ממשיכים את
+ההקבלה שבין C-f ו־M-f (אמנם <Delback> איננו תו בקרה, בוא נזניח את
+הנקודה הזו לעת־עתה). C-k ו־M-k דומים ל־C-e ו־M-e, אם נקביל שורות
 למשפטים.
 
 בנוסף, קיימת שיטה אחידה שמאפשרת לגזור קטע כלשהו של טקסט. לשם כך, תגיעו
@@ -340,25 +340,25 @@
 >> הקישו C-<SPC>‎. ‏Emacs צריך להציג הודעה האומרת "Mark set" בתחתית
    התצוגה.
 >> הניעו את הסמן אל האות צ בשורה השניה של הפיסקה.
->> הקישו C-w. בכך תגזרו את חלק הטקסט שמתחיל ב-ב ומסתיים לפני ה-צ.
+>> הקישו C-w. בכך תגזרו את חלק הטקסט שמתחיל ב־ב ומסתיים לפני ה־צ.
 
-ההבדל בין "מחיקה" ("deletion") ו-"גזירה" ("killing") הוא שהטקסט
+ההבדל בין "מחיקה" ("deletion") ו־"גזירה" ("killing") הוא שהטקסט
 "הגזור" ניתן לאחזור ולהכנסה (במקום כלשהוא בטקסט), ואילו טקסט "מחוק" לא
 ניתן להכניס מחדש בשיטה זו. (אבל ניתן לבטל את מחיקה -- ראה להלן.) אחזור
 הטקסט הגזור נקרא "הדבקה" ("yanking"). באופן כללי, פקודות אשר עלולות
 להעלים כמויות גדולות של טקסט תמיד גוזרות את הטקסט (כך שניתן יהיה בקלות
 לשחזרו) בעוד הפקודות שמורידות תו בודד או שורות ריקות ותוי רווח --
-מוחקות (כך שלא ניתן להדביק את הטקסט שנמחק). כך, <Delback> ו-C-d מוחקים
+מוחקות (כך שלא ניתן להדביק את הטקסט שנמחק). כך, <Delback> ו־C-d מוחקים
 כאשר מפעילים אותם ללא ארגומנט, אבל גוזרים כאשר מפעילים אותם עם ארגומנט.
 
->> הניעו את הסמן לתחילת שורה שאינה ריקה. אחר-כך הקישו C-k כדי לגזור
+>> הניעו את הסמן לתחילת שורה שאינה ריקה. אחר־כך הקישו C-k כדי לגזור
    את כל הטקסט של אותה שורה.
->> הקישו C-k פעם נוספת. שימו לב שהוא גוזר את ה-Newline שבסוף השורה.
+>> הקישו C-k פעם נוספת. שימו לב שהוא גוזר את ה־Newline שבסוף השורה.
 
-שימו לב ש-C-k בודד גוזר את תכולת השורה, ו-C-k נוסף גוזר גם את השורה
+שימו לב ש־C-k בודד גוזר את תכולת השורה, ו־C-k נוסף גוזר גם את השורה
 עצמה וגורם לשאר השורות לנוע כלפי מעלה. C-k מפרש את הארגומנט הנומרי
-באופן מיוחד: הוא גוזר כמספר הזה שורות, כולל ה-Newlines שלהן. זה שונה
-מסתם הפעלה חוזרת: C-u 2 C-k גוזר שתי שורות כולל ה-Newlines שלהן,
+באופן מיוחד: הוא גוזר כמספר הזה שורות, כולל ה־Newlines שלהן. זה שונה
+מסתם הפעלה חוזרת: C-u 2 C-k גוזר שתי שורות כולל ה־Newlines שלהן,
 ואילו הקשה על C-k פעמיים לא עושה כן.
 
 אחזור הטקסט שגזרנו נקרא "הדבקה" ("yanking"). (תחשבו על זה כעל שליפה
@@ -366,21 +366,21 @@
 באותו מקום ממנו נגזר או במקום אחר כלשהו בתוך הטקסט שאתם עורכים, או
 אפילו בקובץ אחר. ניתן להדביק את אותו הטקסט מספר פעמים ובכך ליצור
 עותקים מרובים ממנו. תוכניות עריכה אחרות משתמשות במונחים "cutting"
-ו-"pasting" במקום "killing" ו-"yanking" (ראה את מילון המונחים בפרק
-ה-"Glossary" של מדריך למשתמשי Emacs).
+ו־"pasting" במקום "killing" ו־"yanking" (ראה את מילון המונחים בפרק
+ה־"Glossary" של מדריך למשתמשי Emacs).
 
 הפקודה להדבקה היא C-y. היא מכניסה את הטקסט הגזור במקום הנוכחי של הסמן.
 
 >> נסו זאת: הקישו C-y כדי לאחזר טקסט שגזרתם קודם לכן.
 
 אם תקישו C-k מספר פעמים ברצף, כל הטקסט שגזרתם בדרך זו נשמר ביחד, כך
-ש-C-y בודד ידביק את כולו בבת אחת.
+ש־C-y בודד ידביק את כולו בבת אחת.
 
 >> עשו זאת עתה: הקישו C-k כמה פעמים.
 
 עכשיו לאחזור הטקסט שגזרתם:
 
->> הקישו C-y. אחר-כך הניעו את הסמן כמה שורות כלפי מטה והקישו C-y שוב.
+>> הקישו C-y. אחר־כך הניעו את הסמן כמה שורות כלפי מטה והקישו C-y שוב.
    כפי שראיתם, כך תוכלו להעתיק חלק מהטקסט ממקום למקום.
 
 מה לעשות אם יש לכם טקסט להדבקה, אבל בינתיים גזרתם טקסט אחר? C-y ידביק
@@ -394,7 +394,7 @@
 אם תקישו M-y מספיק פעמים בזו אחר זו, תגיעו חזרה לנקודת ההתחלה (טקסט
 שגזרתם לאחרונה).
 
->> גזרו שורה, אחר-כך תניעו את הסמן אנה ואנה, ולבסוף גזרו שורה נוספת.
+>> גזרו שורה, אחר־כך תניעו את הסמן אנה ואנה, ולבסוף גזרו שורה נוספת.
    הקישו C-y כדי לאחזר את השורה השניה שגזרתם.
    עתה הקישו M-y והשורה שאחזרתם תוחלף בשורה הראשונה שגזרתם.
    הקישו M-y מספר פעמים נוספות ושימו לב לתוצאות. המשיכו להקיש M-y
@@ -415,14 +415,14 @@
 ופקודות גלילה) אינן נספרות ותוים שמכניסים את עצמם מקובצים בקבוצות של
 עד 20, כדי להקטין את מספר הפעמים שיש להקיש C-x u כדי לבטל הכנסת טקסט.
 
->> גזרו שורה זו עם C-k, אחר-כך הקישו C-x u והיא תופיע שוב.
+>> גזרו שורה זו עם C-k, אחר־כך הקישו C-x u והיא תופיע שוב.
 
 ‏C-_‎ הינה דרך חלופית להפעיל את פקודת הביטול. היא פועלת בדיוק כמו C-x u,
 אבל קלה יותר להקשה מספר פעמים בזו אחר זו. החסרון של C-_‎ הוא שבכמה
 מקלדות לא ברור מאליו כיצד להקיש זאת. זו הסיבה לקיומו של C-x u. במקלדות
 אחדות ניתן להקיש C-_‎ ע"י החזקת CONTROL והקשת לוכסן /.
 
-ארגומנט נומרי ל-C-_‎ או ל-C-x u משמש כמספר החזרות על הפקודה.
+ארגומנט נומרי ל־C-_‎ או ל־C-x u משמש כמספר החזרות על הפקודה.
 
 ניתן לבטל מחיקה של טקסט בדיוק כמו שניתן לבטל גזירה. ההבדלים בין מחיקה
 וגזירה משפיעים על יכולתכם להדביק את הטקסט הגזור עם C-y; הם אינם חשובים
@@ -432,8 +432,8 @@
 * קבצים
 -------
 
-על-מנת שהטקסט שערכתם יישמר, יש לשים אותו בקובץ. אחרת, הוא ייעלם ברגע
-שתצאו מ-Emacs. כדי לשים את הטקס בקובץ, יש "לפתוח" ("find") את הקובץ
+על־מנת שהטקסט שערכתם יישמר, יש לשים אותו בקובץ. אחרת, הוא ייעלם ברגע
+שתצאו מ־Emacs. כדי לשים את הטקס בקובץ, יש "לפתוח" ("find") את הקובץ
 לפני שמתחילים להקיש טקסט. (שם אחר לכך הוא "לפקוד" את הקובץ - "visit".)
 
 פתיחת הקובץ משמעותה שתוכן הקובץ מוצג בתוך Emacs. מבחינות רבות הדבר
@@ -445,8 +445,8 @@
 אם תביטו בחלק התחתון של התצוגה, תראו שם שורה בולטת שמתחילה ומסתיימת
 במקפים וליד הקצה השמאלי שלה כתוב "TUTORIAL.he". חלק זה של התצוגה בדרך
 כלל מציג את שם הקובץ אותו אתם פוקדים. כרגע אתם פוקדים קובץ בשם
-"TUTORIAL.he" שהוא עותק הטיוטה האישי שלכם של שיעור השימוש ב-Emacs.
-פתיחת קובץ כלשהו ב-Emacs תציג את שמו של הקובץ במקום זה.
+"TUTORIAL.he" שהוא עותק הטיוטה האישי שלכם של שיעור השימוש ב־Emacs.
+פתיחת קובץ כלשהו ב־Emacs תציג את שמו של הקובץ במקום זה.
 
 היבט אחד מיוחד של פתיחת קובץ הוא שיש לציין את שם הקובץ אשר ברצונכם
 לפתוח. אנו אומרים שהפקודה "קוראת ארגומנט מהמסוף" (במקרה זה הארגומנט
@@ -455,21 +455,21 @@
 	‏C-x C-f    פתח קובץ
 
 ‏Emacs מבקש שתקישו את שם הקובץ. שם הקובץ שתקישו מופיע בשורה התחתונה של
-התצוגה. שורה זו נקראת "מיני-חוצץ" ("minibuffer") כשהיא משמשת לסוג זה
+התצוגה. שורה זו נקראת "מיני־חוצץ" ("minibuffer") כשהיא משמשת לסוג זה
 של קלט. ניתן להשתמש בכל פקודות העריכה הרגילות של Emacs כשמקישים את
 שם הקובץ בחוצץ זה.
 
-אם טרם סיימתם להקיש את שם הקובץ (או כל סוג אחר של קלט במיני-חוצץ),
+אם טרם סיימתם להקיש את שם הקובץ (או כל סוג אחר של קלט במיני־חוצץ),
 ניתן לבטל את הפקודה בעזרת C-g.
 
->> הקישו C-x C-f ואחר-כך הקישו C-g. זה מבטל את המיני-חוצץ וגם מבטל
-   את הפקודה C-x C-f שהשתמשה במיני-חוצץ. התוצאה היא שאף קובץ לא נפתח.
+>> הקישו C-x C-f ואחר־כך הקישו C-g. זה מבטל את המיני־חוצץ וגם מבטל
+   את הפקודה C-x C-f שהשתמשה במיני־חוצץ. התוצאה היא שאף קובץ לא נפתח.
 
-משסיימתם להקיש את שם הקובץ, הקישו <Return> לסיים את הקלט. או-אז תיגש
-C-x C-f לעבודה ותמצא ותפתח את הקובץ שבחרתם. המיני-חוצץ נעלם כאשר
-פקודת ה-C-x C-f תסיים את עבודתה.
+משסיימתם להקיש את שם הקובץ, הקישו <Return> לסיים את הקלט. או־אז תיגש
+C-x C-f לעבודה ותמצא ותפתח את הקובץ שבחרתם. המיני־חוצץ נעלם כאשר
+פקודת ה־C-x C-f תסיים את עבודתה.
 
-זמן קצר אחר-כך תוכן הקובץ יופיע על-גבי התצוגה ותוכלו לבצע בו שינויים.
+זמן קצר אחר־כך תוכן הקובץ יופיע על־גבי התצוגה ותוכלו לבצע בו שינויים.
 כשתחליטו לשמור את השינויים, הקישו את הפקודה הבאה:
 
 	‏C-x C-s    שמור את הקובץ
@@ -479,13 +479,13 @@
 לאיבוד. השם החדש נוצר ע"י הוספת "~" בסוף השם המקורי של הקובץ.
 
 כשהשמירה מסתיימת, Emacs מציג בשורה התחתונה את שם הקובץ שנשמר. נסו
-לשמור לעתים מזומנות על-מנת להימנע מלאבד יותר מדי מהעבודה שלכם אם המחשב
+לשמור לעתים מזומנות על־מנת להימנע מלאבד יותר מדי מהעבודה שלכם אם המחשב
 ייפול (ראה להלן פיסקה על שמירה אוטומטית).
 
 >> הקישו C-x C-s כדי לשמור את העותק שלכם של השיעור.
    כתוצאה, תופיע ההודעה "Wrote ... TUTORIAL.he" בתחתית התצוגה.
 
-ניתן לפתוח קובץ קיים על-מנת לצפות בו או לערוך אותו. ניתן גם לפתוח קובץ
+ניתן לפתוח קובץ קיים על־מנת לצפות בו או לערוך אותו. ניתן גם לפתוח קובץ
 שאינו קיים. זו הדרך ליצור קבצים חדשים בעזרת Emacs: פתחו את הקובץ
 שיהיה תחילה ריק ואז התחילו להקיש טקסט לתוכו. כשתפעילו את פקודת השמירה,
 Emacs ייצור את הקובץ עם הטקסט שהקשתם. מאותו רגע ואילך, תוכלו לחשוב
@@ -495,11 +495,11 @@
 * חוצצים
 --------
 
-אם תפתחו קובץ נוסף עם C-x C-f, הקובץ הראשון עדיין נשאר פתוח ב-Emacs.
+אם תפתחו קובץ נוסף עם C-x C-f, הקובץ הראשון עדיין נשאר פתוח ב־Emacs.
 תוכלו לחזור אליו ע"י C-x C-f. כך תוכלו לפתוח מספר רב של קבצים.
 
 >> ניצור עתה קובץ בשם "foo" ע"י הקשת C-x C-f foo <Return>‎.
-   אחר-כך הכניסו קצת טקסט, ערכו אותו ולבסוף שמרו בקובץ "foo"
+   אחר־כך הכניסו קצת טקסט, ערכו אותו ולבסוף שמרו בקובץ "foo"
    ע"י C-x C-s. עתה חזרו לשיעור בעזרת C-x C-f TUTORIAL.he <Return>‎.
 
 ‏Emacs מחזיק כל קובץ בתוך יישות בשם "חוצץ" ("buffer"). פתיחת קובץ יוצרת
@@ -523,12 +523,12 @@
 בפקודה C-x b. פקודה זו תחייב אותכם להקיש את שם החוצץ.
 
 >> הקישו C-x b foo <Return>‎ כדי לחזור לחוצץ "foo" אשר מחזיק טקסט של
-   הקובץ "foo". אחר-כך הקישו C-x b TUTORIAL.he <Return>‎ כדי לשוב
+   הקובץ "foo". אחר־כך הקישו C-x b TUTORIAL.he <Return>‎ כדי לשוב
    לשיעור זה.
 
 ברוב המקרים שם החוצץ זהה לשם הקובץ (ללא שם התיקיה שלו). אבל אין זה
 תמיד כך. רשימת החוצצים שנוצרת ע"י C-x C-b תמיד תציג את שמות כל החוצצים
-הקיימים ב-Emacs.
+הקיימים ב־Emacs.
 
 כל טקסט שמוצג בחלון של Emacs הינו תמיד חלק של חוצץ כלשהו. קיימים
 חוצצים שאינם קשורים לשום קובץ. לדוגמא, החוצץ בשם "*Buffer List*" אינו
@@ -537,9 +537,9 @@
 שהופיעו בשורה התחתונה במהלך עבודתכם בתוך Emacs.
 
 >> הקישו C-x b *Messages* <Return>‎ כדי לצפות בחוצץ של הודעות.
-   אחר-כך הקישו C-x b TUTORIAL.he <Return>‎ על-מנת לחזור לשיעור זה.
+   אחר־כך הקישו C-x b TUTORIAL.he <Return>‎ על־מנת לחזור לשיעור זה.
 
-אם עשיתם שינויים בטקסט של קובץ ואחר-כך פתחתם קובץ אחר, אין הדבר שומר
+אם עשיתם שינויים בטקסט של קובץ ואחר־כך פתחתם קובץ אחר, אין הדבר שומר
 את השינויים שעשיתם לקובץ הראשון. השינויים הללו נשארים בתוך Emacs, בתוך
 החוצץ של אותו קובץ. יצירתו ועריכתו של הקובץ הנוסף אינם משפיעים על
 החוצץ של הקובץ הראשון. דבר זה הוא שימושי, אך משמעותו היא שיש צורך
@@ -552,7 +552,7 @@
 ‏C-x s עובר על כל החוצצים אשר מכילים שינויים שטרם נשמרו. לגבי כל חוצץ
 כזה הוא שואל אתכם האם לשמור אותו או לא.
 
->> הכניסו שורה של טקסט ואחר-כך הקישו C-x s.
+>> הכניסו שורה של טקסט ואחר־כך הקישו C-x s.
    הוא צריך לשאול האם לשמור חוצץ בשם TUTORIAL.he.
    השיבו בחיוב ע"י הקשה על "y".
 
@@ -560,8 +560,8 @@
 * הרחבת אוסף הפקודות
 --------------------
 
-מספר הפקודות ב-Emacs גדול בהרבה ממה שניתן להפעיל ע"י כל תוי ה-control
-וה-meta. כדי להתגבר על בעיה זו, Emacs משתמש בפקודות X המרחיבות (eXtend)
+מספר הפקודות ב־Emacs גדול בהרבה ממה שניתן להפעיל ע"י כל תוי ה־control
+וה־meta. כדי להתגבר על בעיה זו, Emacs משתמש בפקודות X המרחיבות (eXtend)
 את אוסף הפקודות הרגיל. פקודות הרחבה אלו הן שתים:
 
 	‏C-x     הרחבת תו. תו בודד שבא אחריו משלים את הפקודה.
@@ -569,24 +569,24 @@
 
 בעזרת שתי אלו ניתן להפעיל פקודות שימושיות שבהן משתמשים לעתים רחוקות
 יותר מאשר פקודות שלמדתם עד עכשיו. כמה מהן כבר ראיתם: C-x C-f לפתיחת
-קובץ, ו-C-x C-s לשמירת קובץ, לדוגמא. דוגמא נוספת היא פקודה לצאת
-מ-Emacs -- ‏C-x C-c. (כשאתם מפעילים C-x C-c, אל תדאגו לשינויים שטרם
+קובץ, ו־C-x C-s לשמירת קובץ, לדוגמא. דוגמא נוספת היא פקודה לצאת
+מ־Emacs -- ‏C-x C-c. (כשאתם מפעילים C-x C-c, אל תדאגו לשינויים שטרם
 נשמרו; C-x C-c מציע לשמור כל קובץ ששיניתם לפני שהוא מסיים את Emacs.)
 
 אם אתם משתמשים בצג גרפי אשר תומך במספר תוכניות במקביל, אינכם זקוקים
-לפקודה מיוחדת כדי לעבור מ-Emacs לתוכנית אחרת. אפשר לעשות זאת בעזרת
+לפקודה מיוחדת כדי לעבור מ־Emacs לתוכנית אחרת. אפשר לעשות זאת בעזרת
 העכבר או פקודות של מנהל החלונות. אולם, כאשר אתם משתמשים בתצוגה
-טקסטואלית שמסוגלת להציג רק תוכנית אחת בו-זמנית, תצטרכו "להשעות"
-("suspend") את Emacs על-מנת לעבור לתוכנית אחרת.
+טקסטואלית שמסוגלת להציג רק תוכנית אחת בו־זמנית, תצטרכו "להשעות"
+("suspend") את Emacs על־מנת לעבור לתוכנית אחרת.
 
-הפקודה C-z יוצאת מ-Emacs *באופן זמני* -- כך שתוכלו לשוב אליו מאוחר
+הפקודה C-z יוצאת מ־Emacs *באופן זמני* -- כך שתוכלו לשוב אליו מאוחר
 יותר ולהמשיך מאותה נקודה. כאשר Emacs רץ על תצוגת טקסט, C-z "משעה" את
 Emacs: הוא מחזיר אתכם לשורת הפקודות הבסיסית של מערכת ההפעלה ("shell"),
-אבל אינו מסיים את Emacs. ברוב המערכות, כדי להמשיך בעבודתכם ב-Emacs,
+אבל אינו מסיים את Emacs. ברוב המערכות, כדי להמשיך בעבודתכם ב־Emacs,
 תצטרכו להקיש את הפקודה "fg" או ‭"%emacs"‬.
 
-הרגע הנכון להשתמש ב-C-x C-c הוא כאשר אתם עומדים להתנתק (log out).
-כמו-כן, תצטרכו להשתמש בו כדי לצאת מ-Emacs שהופעל ע"י תוכניות אחרות
+הרגע הנכון להשתמש ב־C-x C-c הוא כאשר אתם עומדים להתנתק (log out).
+כמו־כן, תצטרכו להשתמש בו כדי לצאת מ־Emacs שהופעל ע"י תוכניות אחרות
 כגון קריאת דואר אלקטרוני -- תוכניות אלו לא תמיד יודעות להסתדר עם
 השעיית Emacs.
 
@@ -597,7 +597,7 @@
 	‏C-x s  	שמור חוצצים אחדים
 	‏C-x C-b 	הצג רשימת חוצצים
 	‏C-x b  	החלף חוצץ
-	‏C-x C-c 	צא מ-Emacs
+	‏C-x C-c 	צא מ־Emacs
 	‏C-x 1  	השאר רק חלון אחד ומחק כל השאר
 	‏C-x u  	בטל פקודה אחרונה
 
@@ -605,9 +605,9 @@
 ספציפיות רק לאופני פעולה (modes) מיוחדים. דוגמא לכך היא פקודה
 replace-string (החלף מחרוזת) אשר מחליפה מחרוזת אחת במשנה בכל החוצץ.
 אחרי שתקישו M-x, ‏Emacs מציג M-x בתחתית התצוגה ומחכה שתקישו את שם
-הפקודה, במקרה זה "replace-string". מספיק שתקישו "repl s<TAB>‎" ו-Emacs
+הפקודה, במקרה זה "replace-string". מספיק שתקישו "repl s<TAB>‎" ו־Emacs
 ישלים את השם המלא. (<TAB> הוא מקש Tab, בדרך כלל תמצאו אותו מעל מקש
-ה-CapsLock או Shift, ליד הקצה השמאלי של המקלדת.) סיימו את שם הפקודה
+ה־CapsLock או Shift, ליד הקצה השמאלי של המקלדת.) סיימו את שם הפקודה
 ע"י הקשת <Return>.
 
 הפקודה להחלפת מחרוזת זקוקה לשני ארגומנטים -- המחרוזת שתוחלף וזו שתחליף
@@ -625,7 +625,7 @@
 ----------------
 
 שינויים שערכתם בקובץ אבל טרם שמרתם עלולים ללכת לאיבוד אם המחשב שלכם
-נתקע. על-מנת להגן עליכם מפני סכנה זו, Emacs שומר לעתים מזומנות כל קובץ
+נתקע. על־מנת להגן עליכם מפני סכנה זו, Emacs שומר לעתים מזומנות כל קובץ
 שנמצא בעריכה. השמירה האוטומטית הזאת נעשית לקובץ נפרד ששמו מתחיל
 ומסתיים בתו #. לדוגמא, אם הינכם עורכים קובץ בשם "hello.c", קובץ השמירה
 האוטומטית שיווצר עבורו ייקרא "#hello.c#". שמירה רגילה של הקובץ על ידכם
@@ -633,8 +633,8 @@
 
 אם המחשב אכן נתקע, תוכלו לנציל את השינויים שלא הספקתם לשמור. לשם כך,
 יש לפתוח את הקובץ כרגיל (את הקובץ בשמו המקורי, לא את קובץ השמירה
-האוטומטית), ואחר-כך להקיש M-x recover-file <Return>‎. כש-Emacs יבקש
-אישור, הקישו yes<Return>‎ כדי ש-Emacs ישחזר את הקובץ כפי שנשמר
+האוטומטית), ואחר־כך להקיש M-x recover-file <Return>‎. כש־Emacs יבקש
+אישור, הקישו yes<Return>‎ כדי ש־Emacs ישחזר את הקובץ כפי שנשמר
 אוטומטית.
 
 
@@ -659,7 +659,7 @@
 את מיקומכם הנוכחי בתוך הטקסט, לאמור כי NN אחוזים מהטקסט קודמים לטקסט
 המוצג כרגע בחלון. אם המוצג בחלון כולל את תחילת הטקסט, תראו שם "Top"
 במקום "0% ". אם המוצג בחלון כולל את סוף הטקסט, תראו שם "Bot" ‏(bottom).
-אם הטקסט כל-כך קצר שכולו מוצג בחלון, שורת הסטטוס תציג "All".
+אם הטקסט כל־כך קצר שכולו מוצג בחלון, שורת הסטטוס תציג "All".
 
 האות L והמספר שאחריה מציינים את המיקום הנוכחי בדרך אחרת: הם מראים את
 מספר השורה שבה נמצא הסמן.
@@ -672,7 +672,7 @@
 כעת. ברירת המחדל היא Fundamental, האופן הבסיס, שבו אתם משתמשים כעת.
 זוהי דוגמא של "אופן עריכה ראשי" (major mode).
 
-ל-Emacs אופני עריכה ראשיים רבים ומגוונים. חלק מהם נועדו לעריכה של שפת
+ל־Emacs אופני עריכה ראשיים רבים ומגוונים. חלק מהם נועדו לעריכה של שפת
 תכנות מסוימת ו/או סוג מסוים של טקסט, כגון Lisp mode, Text mode וכד'.
 בכל רגע נתון רק אופן עיקרי אחד יכול להיות פעיל ושמו תמיד מצויין בשורת
 הסטטוס באותו מקום בו כרגע אתם רואים "Fundamental".
@@ -684,31 +684,31 @@
 למשל הפקודה להפעיל את האופן Fundamental הינה M-x fundamental-mode.
 
 אם בכוונתכם לערוך טקסט בשפה אנושית כלשהי, כמו הקובץ הזה, כדאי לכם
-להשתמש ב-Text mode.
+להשתמש ב־Text mode.
 
 >> הקישו M-x text-mode <Return>‎.
 
 אל דאגה: אף אחת מפקודות Emacs שלמדתם עד כה משנה את התנהגותה באופן
-מהותי. עם זאת, שימו לב ש-M-f ו-M-b מתייחסים עכשיו ל-'גרש' כחלק מהמילה.
-לפני-כן, ב-Fundamental mode, ‏M-f ו-M-b התנהגו עם הגרש כמפריד בין
+מהותי. עם זאת, שימו לב ש־M-f ו־M-b מתייחסים עכשיו ל־'גרש' כחלק מהמילה.
+לפני־כן, ב־Fundamental mode, ‏M-f ו־M-b התנהגו עם הגרש כמפריד בין
 מילים.
 
-אופנים ראשיים בדרך-כלל משנים קלות את התנהגות הפקודות: רוב הפקודות
+אופנים ראשיים בדרך־כלל משנים קלות את התנהגות הפקודות: רוב הפקודות
 עדיין "עושות אותה עבודה" בכל האופנים הראשיים, אבל עושות אותה קצת אחרת.
 
 לצפיה בתיעוד של האופן הראשי הנוכחי יש להקיש C-h m.
 
->> השתמשו ב-C-u C-v פעם אחת או יותר כדי להביא שורה זו לראשית התצוגה.
->> עתה הקישו C-h m כדי לראות במה Text mode שונה מה-Fundamental mode.
+>> השתמשו ב־C-u C-v פעם אחת או יותר כדי להביא שורה זו לראשית התצוגה.
+>> עתה הקישו C-h m כדי לראות במה Text mode שונה מה־Fundamental mode.
 >> לבסוף, הקישו C-x 1 כדי לסלק את התיעוד מהתצוגה.
 
-אופנים ראשיים נקראים כך משום שקיימים גם אופני-משנה (minor modes).
+אופנים ראשיים נקראים כך משום שקיימים גם אופני־משנה (minor modes).
 אופני משנה אינם מהווים חלופה לאופנים הראשיים, הם רק משנים אותם במקצת.
-כל אופן-משנה ניתן להפעלה או ביטול ללא תלות בכל שאר אופני המשנה וללא
-תלות באופן הראשי הנוכחי. לכן תוכלו להפעיל אופן-משנה אחד או יותר, או אף
-אופן-משנה.
+כל אופן־משנה ניתן להפעלה או ביטול ללא תלות בכל שאר אופני המשנה וללא
+תלות באופן הראשי הנוכחי. לכן תוכלו להפעיל אופן־משנה אחד או יותר, או אף
+אופן־משנה.
 
-אחד מאופני-המשנה השימושיים ביותר, במיוחד לשם עריכת טקס בשפת-אנוש, הוא
+אחד מאופני־המשנה השימושיים ביותר, במיוחד לשם עריכת טקס בשפת־אנוש, הוא
 Auto Fill mode. כאשר אופן זה מופעל, Emacs אוטומטית פותח שורה חדשה
 בסיום מילה אם הטקסט שהקשתם ארוך מדי בשביל שורה אחת.
 
@@ -717,17 +717,17 @@
 זו מפעילה את האופן כשאינו פעיל ומבטלת אותו כשהוא פעיל. לפעולה זו
 קוראים "מיתוג" -- הפקודה "ממתגת" את האופן.
 
->> הקישו עתה M-x auto-fill-mode <Return>‎. אחר-כך הקישו "שדגכ " (עם
+>> הקישו עתה M-x auto-fill-mode <Return>‎. אחר־כך הקישו "שדגכ " (עם
    הרווח בסוף) שוב ושוב עד שתיפתח שורה חדשה. הרווחים חשובים משום
-   ש-Auto Fill mode שובר שורות אך ורק ברווח שבין המלים.
+   ש־Auto Fill mode שובר שורות אך ורק ברווח שבין המלים.
 
-השוליים (margin) ש-Emacs שומר בדרך-כלל מתחילים אחרי 70 תווים, אבל ניתן
+השוליים (margin) ש־Emacs שומר בדרך־כלל מתחילים אחרי 70 תווים, אבל ניתן
 לשנות הגדרה זו בעזרת הפקודה C-x f. פקודה זו מקבלת את ההגדרה החדשה של
 השוליים כארגומנט נומרי.
 
->> הקישו C-x f עם ארגומנט של 20. (C-u 2 0 C-x f). אחר-כך הקישו טקסט
-   כלשהו ושימו לב ש-Emacs פותח שורות חדשות אחרי 20 תווים לכל היותר.
-   לבסוף, החזירו את הגדרת השוליים ל-70 ע"י שימוש חוזר ב-C-x f.
+>> הקישו C-x f עם ארגומנט של 20. (C-u 2 0 C-x f). אחר־כך הקישו טקסט
+   כלשהו ושימו לב ש־Emacs פותח שורות חדשות אחרי 20 תווים לכל היותר.
+   לבסוף, החזירו את הגדרת השוליים ל־70 ע"י שימוש חוזר ב־C-x f.
 
 אם ערכתם שינויים באמצע פסקה, Auto Fill mode לא ימלא שורות מחדש באופן
 אוטומטי.
@@ -747,15 +747,15 @@
 החיפוש של Emacs הינו "מצטבר" ("incremental"). פירוש הדבר הוא שהחיפוש
 מתבצע במקביל להקשתכם את המחרוזת אותה ברצונכם למצוא.
 
-הפקודה להתחיל בחיפוש היא C-s לחיפוש קדימה ו-C-r לחיפוש אחורה. חכו! אל
+הפקודה להתחיל בחיפוש היא C-s לחיפוש קדימה ו־C-r לחיפוש אחורה. חכו! אל
 תפעילו אותן עדיין.
 
 כשתקישו C-s, תראו שבאזור תצוגת ההד יופיע הטקסט "I-search". זה אומר
-ש-Emacs נמצא במצב "חיפוש מצטבר" ("incremental search") והוא ממתין
+ש־Emacs נמצא במצב "חיפוש מצטבר" ("incremental search") והוא ממתין
 להקשתכם את המחרוזת אותה ברצונכם למצוא. הקשה על <Return> מסיימת את
 החיפוש.
 
->> הקישו עתה C-s כדי להתחיל בחיפוש. לאט-לאט, אות-אות, הקישו את המילה
+>> הקישו עתה C-s כדי להתחיל בחיפוש. לאט־לאט, אות־אות, הקישו את המילה
    "סמן", עם הפסקה אחרי כל אות, ושימו לב להתנהגות הסמן.
    זה עתה מצאתם את המילה "סמן" פעם אחת.
 >> הקישו C-s שוב, כדי למצוא את "סמן" במקומות נוספים בטקסט.
@@ -770,18 +770,18 @@
 
 (הערה: במערכות אחדות הקשה על C-s מקפיעה את תצוגת המסך, כך שלא תראו
 יותר שום פלט של Emacs. משמעות הדבר שתכונת מערכת ההפעלה ששמה "flow
-control" מופעלת ע"י C-s ואינה מעבירה את C-s ל-Emacs. לביטול הקפאת
+control" מופעלת ע"י C-s ואינה מעבירה את C-s ל־Emacs. לביטול הקפאת
 התצוגה במערכות אלו יש להקיש C-q.)
 
 אם במהלך החיפוש תקישו על <Delback>, תראו שהתו האחרון של המחרוזת
 המבוקשת נמחק והחיפוש חוזר למקום הקודם בו נמצאה המחרוזת ללא התו האחרון.
-למשל, נניח שהקשתם "ס" על-מנת למצוא את המקום הבא בו מופיעה האות "ס". אם
+למשל, נניח שהקשתם "ס" על־מנת למצוא את המקום הבא בו מופיעה האות "ס". אם
 עכשיו תקישו "מ", הסמן יזוז למקום בו נמצא "סמ". עתה הקישו <Delback>.
-ה-"מ" נמחק מהמחרוזת והסמן חוזר למקום בו הוא מצא את "ס" לראשונה.
+ה־"מ" נמחק מהמחרוזת והסמן חוזר למקום בו הוא מצא את "ס" לראשונה.
 
 אם במהלך החיפוש תפעילו פקודה כלשהי ע"י הקשה על מקש תוך לחיצה על
 CONTROL או META, החיפוש יסתיים. (כמה תווים יוצאים מכלל זה -- אלו תווים
-מיוחדים בעת חיפוש, כדוגמת C-s ו-C-r.)
+מיוחדים בעת חיפוש, כדוגמת C-s ו־C-r.)
 
 הקשה על C-s מתחילה חיפוש שמנסה למצוא את המחרוזת _אחרי_ הסמן. אם
 ברצונכם למצוא משהו בטקסט הקודם למקום הנוכחי, הקישו C-r במקום C-s. כל
@@ -792,7 +792,7 @@
 ---------------
 
 אחת התכונות הנוחות של Emacs היא כי ניתן להציג יותר מחלון אחד על המסך
-בו-זמנית. (הערה: Emacs משתמש במונח "frame" -- "תבנית" -- בשביל מה
+בו־זמנית. (הערה: Emacs משתמש במונח "frame" -- "תבנית" -- בשביל מה
 שתוכניות אחרות מכנות "חלון". תבניות מתוארות בפסקה הבאה. תוכלו למצוא את
 רשימת המונחים של Emacs בפרק "Glossary" של מדריך משתמש.)
 
@@ -804,15 +804,15 @@
 >> הקישו C-M-v כדי לגלול את החלון התחתון.
    (אם במקלדת שלכם אין מקש META אמיתי, הקישו ‎<ESC> C-v כתחליף.)
 
->> הקישו C-x o ‏("o" הוא רמז ל-"other", "אחר") על-מנת להעביר את הסמן
+>> הקישו C-x o ‏("o" הוא רמז ל־"other", "אחר") על־מנת להעביר את הסמן
    לחלון התחתון.
->> הקישו C-v ו-M-v בחלון התחתון כדי לגלול אותו.
+>> הקישו C-v ו־M-v בחלון התחתון כדי לגלול אותו.
    המשיכו לקרוא הוראות אלו בחלון העליון.
 
 >> הקישו C-x o שוב לחזור לחלון העליון.
-   הסמן בחלון העליון יישאר במקום בו הוא היה לפני-כן.
+   הסמן בחלון העליון יישאר במקום בו הוא היה לפני־כן.
 
-תוכלו להמשיך להשתמש ב-C-x o כדי לדלג בין שני החלונות. לכל חלון מיקום
+תוכלו להמשיך להשתמש ב־C-x o כדי לדלג בין שני החלונות. לכל חלון מיקום
 סמן משלו, אבל רק חלון אחד מציג את הסמן בכל רגע. כל פקודות העריכה
 הרגילות פועלות על החלון שבו מוצג הסמן. אנו קוראים לחלון זה "החלון
 הנבחר".
@@ -823,30 +823,30 @@
 
 ‏C-M-v היא דוגמא אחת של פקודת CONTROL-META. אם במקלדת שלכם קיים מקש
 META אמיתי, תוכלו להקיש את הפקודה ע"י לחיצה והחזקה של מקשי CONTROL
-ו-META גם יחד ואז להקיש v. הסדר שבו תלחצו על CONTROL ו-META אינו משנה
+ו־META גם יחד ואז להקיש v. הסדר שבו תלחצו על CONTROL ו־META אינו משנה
 כי שני המקשים הללו פועלים ע"י שינוי התו המוקש יחד איתם.
 
-אם אין במקלדת מקש META אמיתי ואתם משתמשים ב-<ESC> כתחליף, הסדר כן
+אם אין במקלדת מקש META אמיתי ואתם משתמשים ב־<ESC> כתחליף, הסדר כן
 משנה: חייבים להקיש <ESC> ורק לאחר מכן CONTROL-v, וזאת משום
-ש-CONTROL-<ESC> v לא יעבוד. <ESC> הוא תו בזכות עצמו, שלא כמו CONTROL
+ש־CONTROL-<ESC> v לא יעבוד. <ESC> הוא תו בזכות עצמו, שלא כמו CONTROL
 או META.
 
 >> הקישו C-x 1 (בחלון העליון) כדי לסלק את החלון התחתון.
 
 (אילו הקשתם C-x 1 בחלון התחתון, הייתם מסלקים את החלון העליון. תוכלו
-לחשוב על פקודה זו כ-"השאר רק חלון אחד -- החלון בו אני נמצא עתה".)
+לחשוב על פקודה זו כ־"השאר רק חלון אחד -- החלון בו אני נמצא עתה".)
 
-אין חובה להציג את אותו החוצץ בשני החלונות. תוכלו להשתמש ב-C-x C-f
+אין חובה להציג את אותו החוצץ בשני החלונות. תוכלו להשתמש ב־C-x C-f
 לפתיחת קובץ באחד החלונות -- דבר זה אינו משפיע על החלון השני. אפשר גם
-לפתוח קבצים שונים בכל אחד משני החלונות באופן בלתי-תלוי.
+לפתוח קבצים שונים בכל אחד משני החלונות באופן בלתי־תלוי.
 
 הנה עוד שיטה להשתמש בשני חלונות להצגה של שני דברים שונים:
 
->> הקישו C-x 4 C-f ואחר-כך הקישו שם של אחד הקבצים שלכם.
+>> הקישו C-x 4 C-f ואחר־כך הקישו שם של אחד הקבצים שלכם.
    סיימו עם <Return>. שימו לב שהקובץ המבוקש מוצג בחלון התחתון. הסמן
    מדלג לשם אף הוא.
 
->> הקישו C-x o לעבור לחלון העליון ואחר-כך הקישו C-x 1 כדי לסלק את
+>> הקישו C-x o לעבור לחלון העליון ואחר־כך הקישו C-x 1 כדי לסלק את
    החלון התחתון.
 
 
@@ -866,8 +866,8 @@
 >> הקישו M-x delete-frame <Return>‎.
    התבנית שבה הקשתם את הפקודה תיסגר ותיעלם מהמסך.
 
-כמו-כן, ניתן לסגור תבנית בדרך הרגילה הנתמכת ע"י מנהל החלונות של המערכת
-שלכם (בדרך-כלל, ע"י הקלקה על הכפתור המסומן ב-"X" בפינה עליונה של
+כמו־כן, ניתן לסגור תבנית בדרך הרגילה הנתמכת ע"י מנהל החלונות של המערכת
+שלכם (בדרך־כלל, ע"י הקלקה על הכפתור המסומן ב־"X" בפינה עליונה של
 התבנית.) שום מידע אינו הולך לעיבוד כאשר סוגרים תבנית (או חלון). המידע
 הזה פשוט יורד מהתצוגה, אבל ניתן לאחזרו מאוחר יותר.
 
@@ -881,12 +881,12 @@
 
 כדי להחלץ מרמת עריכה רקורסיבית יש להקיש <ESC> <ESC> <ESC>. זוהי פקודה
 כללית של "הימלטות". ניתן להשתמש בה גם כדי לסלק חלונות מיותרים וליציאה
-מתוך מיני-חוצץ.
+מתוך מיני־חוצץ.
 
->> הקישו M-x כדי להיכנס למיני-חוצץ; אחר-כך הקישו <ESC> <ESC> <ESC> כדי
+>> הקישו M-x כדי להיכנס למיני־חוצץ; אחר־כך הקישו <ESC> <ESC> <ESC> כדי
    להיחלץ משם.
 
-הקשה על C-g לא תחלץ אתכם מרמות עריכה רקורסיביות. זאת, משום ש-C-g מבטל
+הקשה על C-g לא תחלץ אתכם מרמות עריכה רקורסיביות. זאת, משום ש־C-g מבטל
 פקודות וארגומנטים _במסגרת_ הרמה הרקורסיבית, מבלי לצאת ממנה.
 
 
@@ -894,14 +894,14 @@
 ------------------
 
 בשיעור הראשון הזה השתדלנו לתת בידיכם מידע שאך יספיק להתחלת השימוש שלכם
-ב-Emacs. ‏Emacs מכיל כל-כך הרבה שאין שום אפשרות לתאר ולהסביר כאן את
+ב־Emacs. ‏Emacs מכיל כל־כך הרבה שאין שום אפשרות לתאר ולהסביר כאן את
 הכל. אולם, סביר שתרצו ללמוד יותר על Emacs שכן יש בו עוד הרבה תכונות
 שימושיות. Emacs כולל פקודות לשם קריאת תיעוד על הפקודות של Emacs.
-הפעלת פקודות "עזרה" אלו תמיד מתחילה במקש CONTROL-h שעל-כן נקרא "מקש
+הפעלת פקודות "עזרה" אלו תמיד מתחילה במקש CONTROL-h שעל־כן נקרא "מקש
 עזרה" ("help").
 
-להפעלת פקודות עזרה יש להקיש את C-h ואחר-כך עוד תו שמבקש עזרה מסוג
-מסויים. אם אתם _באמת_ אבודים, הקישו C-h ?‎ ו-Emacs יציג את סוגי העזרה
+להפעלת פקודות עזרה יש להקיש את C-h ואחר־כך עוד תו שמבקש עזרה מסוג
+מסויים. אם אתם _באמת_ אבודים, הקישו C-h ?‎ ו־Emacs יציג את סוגי העזרה
 שהוא מעמיד לרשותכם. אם הקשתם C-h ובסופו של דבר החלטתם שאין צורך בשום
 עזרה, פשוט הקישו C-g לבטל את הפקודה.
 
@@ -931,7 +931,7 @@
 
 כתוצאה, יוצגו השם והתיעוד של הפונקציה בחלון Emacs נפרד. כשתסיימו לקרוא
 את התיעוד, הקישו C-x 1 כדי לסלק את חלון העזרה. לא חייבים לעשות זאת
-מיד. אפשר לבצע קצת עריכה תוך שימוש בתיעוד המוצג ורק אחר-כך להקיש C-x 1.
+מיד. אפשר לבצע קצת עריכה תוך שימוש בתיעוד המוצג ורק אחר־כך להקיש C-x 1.
 
 הנה עוד כמה פקודות עזרה שימושיות:
 
@@ -939,12 +939,12 @@
 
 >> נסו להקיש C-h f previous-line <Return>‎.
    כתוצאה, יוצג תיעוד מלא של הפונקציה המממשת את הפקודה C-p כפי שהוא
-   ידוע ל-Emacs.
+   ידוע ל־Emacs.
 
 פקודה דומה C-h v מציגה תיעוד של משתנה, כולל אלו שאת הערכים שלהם ניתן
 לשנות כדי לקסטם את Emacs. יש להקיש את שם המשתנה כאשר Emacs יבקש זאת.
 
-    ‏C-h a	פקודות בנוגע לנושא מסויים. הקישו מילת מפתח ו-Emacs
+    ‏C-h a	פקודות בנוגע לנושא מסויים. הקישו מילת מפתח ו־Emacs
 		יציג את רשימת הפקודות ששמותיהן מכילות את מילת המפתח.
 		כל הפקודות הללו ניתנות להפעלה ע"י META-x. עבור חלק
 		מהפקודות תוצג גם סדרת מקשים שמפעילה את הפקודה.
@@ -963,7 +963,7 @@
 		ידועה גם בשם "Info".) פקודה זאת פותחת חוצץ מיוחד הקרוי
 		"*info*" שבו תוכלו לקרוא מדריכים המותקנים במערכת שלכם.
 		הקישו m emacs <Return>‎ כדי לקרוא במדריך למשתמשי Emacs.
-		אם אינכם מכירים את Info, הקישו ? ו-Emacs יקח אתכם
+		אם אינכם מכירים את Info, הקישו ? ו־Emacs יקח אתכם
 		לשיעור על התכונות של Info mode. כשתסיימו עם השיעור
 		הזה, אנו בהחלט ממליצים להשתמש במדריך Emacs בתור התיעוד
 		העיקרי שלכם.
@@ -972,13 +972,13 @@
 * עוד תכונות
 ------------
 
-תוכלו ללמוד עוד על-אודות Emacs ע"י קריאה במדריך למשתמש שלו, אם כספר
+תוכלו ללמוד עוד על־אודות Emacs ע"י קריאה במדריך למשתמש שלו, אם כספר
 מודפס או בגירסה מקוונת בתוך Emacs עצמו. (תוכלו להגיע אל המדריך דרך
 תפריט Help או ע"י הקשה על C-h r.) אולם שתי תכונות שבוודאי ימצאו חן
-בעיניכם הן השלמה אשר חוסכת הקשות, ו-dired שמאפשרת טיפול נוח בקבצים.
+בעיניכם הן השלמה אשר חוסכת הקשות, ו־dired שמאפשרת טיפול נוח בקבצים.
 
 השלמה היא דרך להימנע מהקשות מיותרות. למשל, אם ברצונכם לעבור לחוצץ
-*Messages*, תוכלו להקיש C-x b *M<Tab>‎ ו-Emacs ישלים את שאר האותיות של
+*Messages*, תוכלו להקיש C-x b *M<Tab>‎ ו־Emacs ישלים את שאר האותיות של
 שם החוצץ ככל שניתן להסיק ממה שהקשתם. השלמה פועלת גם על שמות הפקודות
 ושמות קבצים. תכונת ההשלמה מתוארת במלואה במדריך למשתמש Emacs בצומת
 (node) בשם "Completion".
@@ -993,7 +993,7 @@
 * לסיום
 -------
 
-כדי לצאת מ-Emacs יש להקיש C-x C-c.
+כדי לצאת מ־Emacs יש להקיש C-x C-c.
 
 שיעור זה נכתב כדי להיות מובן לכל המשתמשים החדשים, לכן אם מצאתם שמשהו
 כאן אינו ברור, אל תשבו ותאשימו את עצמכם -- תתלוננו!
@@ -1002,8 +1002,8 @@
 * זכויות שימוש
 --------------
 
-שיעור זה הינו צאצא של שורה ארוכה של שיעורים בשימוש ב-Emacs, החל מהגרסה
-הראשונה שנכתבה ע"י Stuart Cracraft עבור גירסת ה-Emacs המקורית.
+שיעור זה הינו צאצא של שורה ארוכה של שיעורים בשימוש ב־Emacs, החל מהגרסה
+הראשונה שנכתבה ע"י Stuart Cracraft עבור גירסת ה־Emacs המקורית.
 
 גירסה זו של השיעור הינה חלק מחבילת GNU Emacs. היא מוגנת בזכויות יוצרים
 וניתנת להעתקה והפצת עותקים בתנאים מסויימים כדלקמן:
@@ -1016,11 +1016,11 @@
 בכל גרסא מאוחרת יותר.
 
 ‏GNU Emacs מופץ מתוך תקווה שהוא יביא תועלת, אולם ללא כל כתב אחריות;
-אפילו לא אחריות-במשתמע של סחירות או התאמה לאיזו תכלית מסוימת. לפרטים,
-אנא עיינו ב-GNU General Public License.
+אפילו לא אחריות־במשתמע של סחירות או התאמה לאיזו תכלית מסוימת. לפרטים,
+אנא עיינו ב־GNU General Public License.
 
 ‏GNU Emacs אמור להיות מלווה בעותק של GNU General Public License; אם לא
-קיבלתם אותו, תוכלו למצוא אותו ב-‭<http://www.gnu.org/licenses/>‬.
+קיבלתם אותו, תוכלו למצוא אותו ב־‭<http://www.gnu.org/licenses/>‬.
 
 הנכם מוזמנים לקרוא את הקובץ COPYING ואז אכן לחלק עותקים של GNU Emacs
 לחבריכם. עזרו לנו לחסל את "הבעלות" על תוכנה שאינה אלא חבלה בתוכנה,
--- a/lib-src/ChangeLog	Wed Aug 11 03:20:07 2010 +0000
+++ b/lib-src/ChangeLog	Sun Aug 15 22:50:44 2010 +0000
@@ -1,3 +1,54 @@
+2010-08-11  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* fakemail.c: Include stdlib.h for getenv. Remove declaration of
+	popen, fclose and pclose.
+	(my_name, fatal, error, put_line): Use const char*
+	(main): Remove extern getenv, mail_program_name is const char*.
+
+	* update-game-score.c (get_prefix, write_scores, main): Use const char*.
+
+	* sorted-doc.c (error, fatal, states): Use const char *.
+
+	* pop.h (pop_multi_first): Use const char *.
+	(_ARGS): Remove.
+
+	* pop.c (pop_multi_first, socket_connection, sendline): Use conat char*.
+
+	* movemail.c (fatal, error, concat): Use const char *.
+
+	* make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use
+	const char *.
+
+	* etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
+	(Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
+	(Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
+	(Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
+	(Fortran_suffixes, Fortran_help, HTML_suffixes,  HTML_help)
+	(Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
+	(Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
+	(Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
+	(Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes)
+	(PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help)
+	(Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes)
+	(Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help)
+	(no_lang_help, print_language_names)
+	(get_language_from_interpreter, get_language_from_filename)
+	(init, make_tag, struct C_stab_entry, write_classname, TEX_defenv)
+	(TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal)
+	(concat): Use const char*.
+
+	* emacsclient.c (message, sock_err_message, send_to_emacs)
+	(quote_argument, set_local_socket)
+	(start_daemon_and_retry_set_socket): Use const char*.
+
+	* ebrowse.c (struct member): filename, def_filename is const.
+	(struct sym): filename, sfilename is const.
+	(struct kw): name is const.
+	(add_sym, yyerror, token_string, insert_keyword, main): Use const char*.
+
+	* b2m.c (concat, fatal): Use const char*.
+	(main): Don't assign labels a string literal.
+
 2010-08-07  Juanma Barranquero  <lekktu@gmail.com>
 
 	* ebrowse.c (usage, version, mark_virtual):
--- a/lib-src/b2m.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/lib-src/b2m.c	Sun Aug 15 22:50:44 2010 +0000
@@ -68,9 +68,9 @@
 
 long *xmalloc (unsigned int size);
 long *xrealloc (char *ptr, unsigned int size);
-char *concat (char *s1, char *s2, char *s3);
+char *concat (const char *s1, const char *s2, const char *s3);
 long readline (struct linebuffer *linebuffer, register FILE *stream);
-void fatal (char *message) NO_RETURN;
+void fatal (const char *message) NO_RETURN;
 
 /*
  * xnew -- allocate storage.  SYNOPSIS: Type *xnew (int n, Type);
@@ -170,6 +170,7 @@
 	    continue;
 	  else if (data.buffer[1] == '\f')
 	    {
+              static char babyl[] = "X-Babyl-Labels: ";
 	      if (first)
 		first = FALSE;
 	      else if (! last_was_blank_line)
@@ -177,7 +178,7 @@
 	      /* Save labels. */
 	      readline (&data, stdin);
 	      p = strtok (data.buffer, " ,\r\n\t");
-	      labels = "X-Babyl-Labels: ";
+	      labels = babyl;
 
 	      while ((p = strtok (NULL, " ,\r\n\t")))
 		labels = concat (labels, p, ", ");
@@ -218,7 +219,7 @@
  * concatenate those of s1, s2, s3.
  */
 char *
-concat (char *s1, char *s2, char *s3)
+concat (const char *s1, const char *s2, const char *s3)
 {
   int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
   char *result = xnew (len1 + len2 + len3 + 1, char);
@@ -305,7 +306,7 @@
 }
 
 void
-fatal (char *message)
+fatal (const char *message)
 {
   fprintf (stderr, "%s: %s\n", progname, message);
   exit (EXIT_FAILURE);
--- a/lib-src/ebrowse.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/lib-src/ebrowse.c	Sun Aug 15 22:50:44 2010 +0000
@@ -249,10 +249,10 @@
   int vis;			/* Visibility (public, ...).  */
   int flags;			/* See F_* above.  */
   char *regexp;			/* Matching regular expression.  */
-  char *filename;		/* Don't free this shared string.  */
+  const char *filename;		/* Don't free this shared string.  */
   int pos;			/* Buffer position of occurrence.  */
   char *def_regexp;		/* Regular expression matching definition.  */
-  char *def_filename;		/* File name of definition.  */
+  const char *def_filename;	/* File name of definition.  */
   int def_pos;			/* Buffer position of definition.  */
   char name[1];			/* Member name.  */
 };
@@ -294,8 +294,8 @@
   struct member *types;		/* List of local types.  */
   char *regexp;			/* Matching regular expression.  */
   int pos;			/* Buffer position.  */
-  char *filename;		/* File in which it can be found.  */
-  char *sfilename;		/* File in which members can be found.  */
+  const char *filename;		/* File in which it can be found.  */
+  const char *sfilename; 	/* File in which members can be found.  */
   struct sym *namesp;		/* Namespace in which defined. .  */
   char name[1];                 /* Name of the class.  */
 };
@@ -353,7 +353,7 @@
 
 /* The name of the current input file.  */
 
-char *filename;
+const char *filename;
 
 /* Three character class vectors, and macros to test membership
    of characters.  */
@@ -444,7 +444,7 @@
 
 struct kw
 {
-  char *name;			/* Spelling.  */
+  const char *name;		/* Spelling.  */
   int tk;			/* Token value.  */
   struct kw *next;		/* Next in collision chain.  */
 };
@@ -470,10 +470,10 @@
 int yylex (void);
 void yyparse (void);
 void re_init_parser (void);
-char *token_string (int);
+const char *token_string (int);
 char *matching_regexp (void);
 void init_sym (void);
-struct sym *add_sym (char *, struct sym *);
+struct sym *add_sym (const char *, struct sym *);
 void add_link (struct sym *, struct sym *);
 void add_member_defn (struct sym *, char *, char *,
                       int, unsigned, int, int, int);
@@ -489,7 +489,7 @@
 void leave_namespace (void);
 void enter_namespace (char *);
 void register_namespace_alias (char *, struct link *);
-void insert_keyword (char *, int);
+void insert_keyword (const char *, int);
 void re_init_scanner (void);
 void init_scanner (void);
 void process_file (char *);
@@ -517,7 +517,7 @@
 struct sym *parse_qualified_ident_or_type (char **);
 void parse_qualified_param_ident_or_type (char **);
 int globals (int);
-void yyerror (char *, char *);
+void yyerror (const char *, const char *);
 void usage (int) NO_RETURN;
 void version (void) NO_RETURN;
 
@@ -531,7 +531,7 @@
    name and line number.  */
 
 void
-yyerror (char *format, char *s)
+yyerror (const char *format, const char *s)
 {
   fprintf (stderr, "%s:%d: ", filename, yyline);
   fprintf (stderr, format, s);
@@ -605,11 +605,11 @@
    create a new symbol and set it to default values.  */
 
 struct sym *
-add_sym (char *name, struct sym *nested_in_class)
+add_sym (const char *name, struct sym *nested_in_class)
 {
   struct sym *sym;
   unsigned h;
-  char *s;
+  const char *s;
   struct sym *scope = nested_in_class ? nested_in_class : current_namespace;
 
   for (s = name, h = 0; *s; ++s)
@@ -1975,7 +1975,7 @@
 
 /* Return a printable representation of token T.  */
 
-char *
+const char *
 token_string (int t)
 {
   static char b[3];
@@ -2111,9 +2111,9 @@
    table.  */
 
 void
-insert_keyword (char *name, int tk)
+insert_keyword (const char *name, int tk)
 {
-  char *s;
+  const char *s;
   unsigned h = 0;
   struct kw *k = (struct kw *) xmalloc (sizeof *k);
 
@@ -2839,7 +2839,7 @@
 {
   static int id_size = 0;
   static char *id = NULL;
-  char *s;
+  const char *s;
   int len;
 
   MATCH ();
@@ -3680,7 +3680,7 @@
 {
   int i;
   int any_inputfiles = 0;
-  static char *out_filename = DEFAULT_OUTFILE;
+  static const char *out_filename = DEFAULT_OUTFILE;
   static char **input_filenames = NULL;
   static int input_filenames_size = 0;
   static int n_input_files;
--- a/lib-src/emacsclient.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/lib-src/emacsclient.c	Sun Aug 15 22:50:44 2010 +0000
@@ -134,7 +134,7 @@
 int current_frame = 1;
 
 /* The display on which Emacs should work.  --display.  */
-char *display = NULL;
+const char *display = NULL;
 
 /* The parent window ID, if we are opening a frame via XEmbed.  */
 char *parent_id = NULL;
@@ -150,7 +150,7 @@
 char *socket_name = NULL;
 
 /* If non-NULL, the filename of the authentication file.  */
-char *server_file = NULL;
+const char *server_file = NULL;
 
 /* PID of the Emacs server process.  */
 int emacs_pid = 0;
@@ -479,7 +479,7 @@
 /* Display a normal or error message.
    On Windows, use a message box if compiled as a Windows app.  */
 void
-message (int is_error, char *message, ...)
+message (int is_error, const char *message, ...)
 {
   char msg[2048];
   va_list args;
@@ -724,7 +724,7 @@
 /* On Windows, the socket library was historically separate from the standard
    C library, so errors are handled differently.  */
 void
-sock_err_message (char *function_name)
+sock_err_message (const char *function_name)
 {
 #ifdef WINDOWSNT
   char* msg = NULL;
@@ -748,7 +748,7 @@
    - the buffer is full (but this shouldn't happen)
    Otherwise, we just accumulate it.  */
 void
-send_to_emacs (HSOCKET s, char *data)
+send_to_emacs (HSOCKET s, const char *data)
 {
   while (data)
     {
@@ -787,10 +787,11 @@
 
    Does not change the string.  Outputs the result to S.  */
 void
-quote_argument (HSOCKET s, char *str)
+quote_argument (HSOCKET s, const char *str)
 {
   char *copy = (char *) xmalloc (strlen (str) * 2 + 1);
-  char *p, *q;
+  const char *p;
+  char *q;
 
   p = str;
   q = copy;
@@ -1026,7 +1027,7 @@
 
 /* Returns 1 if PREFIX is a prefix of STRING. */
 static int
-strprefix (char *prefix, char *string)
+strprefix (const char *prefix, const char *string)
 {
   return !strncmp (prefix, string, strlen (prefix));
 }
@@ -1215,8 +1216,8 @@
     int sock_status = 0;
     int default_sock = !socket_name;
     int saved_errno = 0;
-    char *server_name = "server";
-    char *tmpdir;
+    const char *server_name = "server";
+    const char *tmpdir;
 
     if (socket_name && !strchr (socket_name, '/')
 	&& !strchr (socket_name, '\\'))
@@ -1479,11 +1480,13 @@
     }
   else
     {
-      char *d_argv[] = {"emacs", "--daemon", 0 };
+      char emacs[] = "emacs";
+      char daemon[] = "--daemon";
+      char *d_argv[] = {emacs, daemon, 0 };
       if (socket_name != NULL)
 	{
 	  /* Pass  --daemon=socket_name as argument.  */
-	  char *deq = "--daemon=";
+	  const char *deq = "--daemon=";
 	  char *daemon_arg = alloca (strlen (deq)
 				     + strlen (socket_name) + 1);
 	  strcpy (daemon_arg, deq);
--- a/lib-src/etags.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/lib-src/etags.c	Sun Aug 15 22:50:44 2010 +0000
@@ -272,18 +272,18 @@
 
 typedef struct
 {
-  char *suffix;			/* file name suffix for this compressor */
-  char *command;		/* takes one arg and decompresses to stdout */
+  const char *suffix;           /* file name suffix for this compressor */
+  const char *command;		/* takes one arg and decompresses to stdout */
 } compressor;
 
 typedef struct
 {
-  char *name;			/* language name */
-  char *help;                   /* detailed help for the language */
+  const char *name;             /* language name */
+  const char *help; 		/* detailed help for the language */
   Lang_function *function;	/* parse function */
-  char **suffixes;		/* name suffixes of this language's files */
-  char **filenames;		/* names of this language's files */
-  char **interpreters;		/* interpreters for this language */
+  const char **suffixes;        /* name suffixes of this language's files */
+  const char **filenames;       /* names of this language's files */
+  const char **interpreters;    /* interpreters for this language */
   bool metasource;		/* source used to generate other sources */
 } language;
 
@@ -304,7 +304,7 @@
 {				/* sorting structure */
   struct node_st *left, *right;	/* left and right sons */
   fdesc *fdp;			/* description of file to whom tag belongs */
-  char *name;			/* tag name */
+  char *name; 			/* tag name */
   char *regex;			/* search regexp */
   bool valid;			/* write this tag on the tag file */
   bool is_func;			/* function tag: use regexp in CTAGS mode */
@@ -399,7 +399,7 @@
 static language *get_language_from_filename (char *, bool);
 static void readline (linebuffer *, FILE *);
 static long readline_internal (linebuffer *, FILE *);
-static bool nocase_tail (char *);
+static bool nocase_tail (const char *);
 static void get_tag (char *, char **);
 
 static void analyse_regex (char *);
@@ -407,8 +407,8 @@
 static void regex_tag_multiline (void);
 static void error (const char *, const char *);
 static void suggest_asking_for_help (void) NO_RETURN;
-void fatal (char *, char *) NO_RETURN;
-static void pfatal (char *) NO_RETURN;
+void fatal (const char *, const char *) NO_RETURN;
+static void pfatal (const char *) NO_RETURN;
 static void add_node (node *, node **);
 
 static void init (void);
@@ -418,15 +418,15 @@
 static void free_tree (node *);
 static void free_fdesc (fdesc *);
 static void pfnote (char *, bool, char *, int, int, long);
-static void make_tag (char *, int, bool, char *, int, int, long);
+static void make_tag (const char *, int, bool, char *, int, int, long);
 static void invalidate_nodes (fdesc *, node **);
 static void put_entries (node *);
 
-static char *concat (char *, char *, char *);
+static char *concat (const char *, const char *, const char *);
 static char *skip_spaces (char *);
 static char *skip_non_spaces (char *);
-static char *savenstr (char *, int);
-static char *savestr (char *);
+static char *savenstr (const char *, int);
+static char *savestr (const char *);
 static char *etags_strchr (const char *, int);
 static char *etags_strrchr (const char *, int);
 static int etags_strcasecmp (const char *, const char *);
@@ -469,7 +469,7 @@
 
 /* boolean "functions" (see init)	*/
 static bool _wht[CHARS], _nin[CHARS], _itk[CHARS], _btk[CHARS], _etk[CHARS];
-static char
+static const char
   /* white chars */
   *white = " \f\t\n\r\v",
   /* not in a name */
@@ -569,9 +569,9 @@
  */
 
 /* Ada code */
-static char *Ada_suffixes [] =
+static const char *Ada_suffixes [] =
   { "ads", "adb", "ada", NULL };
-static char Ada_help [] =
+static const char Ada_help [] =
 "In Ada code, functions, procedures, packages, tasks and types are\n\
 tags.  Use the `--packages-only' option to create tags for\n\
 packages only.\n\
@@ -589,7 +589,7 @@
 will just search for any tag `bidule'.";
 
 /* Assembly code */
-static char *Asm_suffixes [] =
+static const char *Asm_suffixes [] =
   { "a",	/* Unix assembler */
     "asm", /* Microcontroller assembly */
     "def", /* BSO/Tasking definition includes  */
@@ -600,7 +600,7 @@
     "src", /* BSO/Tasking C compiler output */
     NULL
   };
-static char Asm_help [] =
+static const char Asm_help [] =
 "In assembler code, labels appearing at the beginning of a line,\n\
 followed by a colon, are tags.";
 
@@ -608,10 +608,10 @@
 /* Note that .c and .h can be considered C++, if the --c++ flag was
    given, or if the `class' or `template' keywords are met inside the file.
    That is why default_C_entries is called for these. */
-static char *default_C_suffixes [] =
+static const char *default_C_suffixes [] =
   { "c", "h", NULL };
 #if CTAGS				/* C help for Ctags */
-static char default_C_help [] =
+static const char default_C_help [] =
 "In C code, any C function is a tag.  Use -t to tag typedefs.\n\
 Use -T to tag definitions of `struct', `union' and `enum'.\n\
 Use -d to tag `#define' macro definitions and `enum' constants.\n\
@@ -619,7 +619,7 @@
 You can tag function declarations and external variables by\n\
 using `--declarations', and struct members by using `--members'.";
 #else					/* C help for Etags */
-static char default_C_help [] =
+static const char default_C_help [] =
 "In C code, any C function or typedef is a tag, and so are\n\
 definitions of `struct', `union' and `enum'.  `#define' macro\n\
 definitions and `enum' constants are tags unless you specify\n\
@@ -631,12 +631,12 @@
 using `--declarations'.";
 #endif	/* C help for Ctags and Etags */
 
-static char *Cplusplus_suffixes [] =
+static const char *Cplusplus_suffixes [] =
   { "C", "c++", "cc", "cpp", "cxx", "H", "h++", "hh", "hpp", "hxx",
     "M",			/* Objective C++ */
     "pdb",			/* Postscript with C syntax */
     NULL };
-static char Cplusplus_help [] =
+static const char Cplusplus_help [] =
 "In C++ code, all the tag constructs of C code are tagged.  (Use\n\
 --help --lang=c --lang=c++ for full help.)\n\
 In addition to C tags, member functions are also recognized.  Member\n\
@@ -645,131 +645,131 @@
 and `CLASS::FUNCTION'.  `operator' definitions have tag names like\n\
 `operator+'.";
 
-static char *Cjava_suffixes [] =
+static const char *Cjava_suffixes [] =
   { "java", NULL };
 static char Cjava_help [] =
 "In Java code, all the tags constructs of C and C++ code are\n\
 tagged.  (Use --help --lang=c --lang=c++ --lang=java for full help.)";
 
 
-static char *Cobol_suffixes [] =
+static const char *Cobol_suffixes [] =
   { "COB", "cob", NULL };
 static char Cobol_help [] =
 "In Cobol code, tags are paragraph names; that is, any word\n\
 starting in column 8 and followed by a period.";
 
-static char *Cstar_suffixes [] =
+static const char *Cstar_suffixes [] =
   { "cs", "hs", NULL };
 
-static char *Erlang_suffixes [] =
+static const char *Erlang_suffixes [] =
   { "erl", "hrl", NULL };
-static char Erlang_help [] =
+static const char Erlang_help [] =
 "In Erlang code, the tags are the functions, records and macros\n\
 defined in the file.";
 
-char *Forth_suffixes [] =
+const char *Forth_suffixes [] =
   { "fth", "tok", NULL };
-static char Forth_help [] =
+static const char Forth_help [] =
 "In Forth code, tags are words defined by `:',\n\
 constant, code, create, defer, value, variable, buffer:, field.";
 
-static char *Fortran_suffixes [] =
+static const char *Fortran_suffixes [] =
   { "F", "f", "f90", "for", NULL };
-static char Fortran_help [] =
+static const char Fortran_help [] =
 "In Fortran code, functions, subroutines and block data are tags.";
 
-static char *HTML_suffixes [] =
+static const char *HTML_suffixes [] =
   { "htm", "html", "shtml", NULL };
-static char HTML_help [] =
+static const char HTML_help [] =
 "In HTML input files, the tags are the `title' and the `h1', `h2',\n\
 `h3' headers.  Also, tags are `name=' in anchors and all\n\
 occurrences of `id='.";
 
-static char *Lisp_suffixes [] =
+static const char *Lisp_suffixes [] =
   { "cl", "clisp", "el", "l", "lisp", "LSP", "lsp", "ml", NULL };
-static char Lisp_help [] =
+static const char Lisp_help [] =
 "In Lisp code, any function defined with `defun', any variable\n\
 defined with `defvar' or `defconst', and in general the first\n\
 argument of any expression that starts with `(def' in column zero\n\
 is a tag.";
 
-static char *Lua_suffixes [] =
+static const char *Lua_suffixes [] =
   { "lua", "LUA", NULL };
-static char Lua_help [] =
+static const char Lua_help [] =
 "In Lua scripts, all functions are tags.";
 
-static char *Makefile_filenames [] =
+static const char *Makefile_filenames [] =
   { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL};
-static char Makefile_help [] =
+static const char Makefile_help [] =
 "In makefiles, targets are tags; additionally, variables are tags\n\
 unless you specify `--no-globals'.";
 
-static char *Objc_suffixes [] =
+static const char *Objc_suffixes [] =
   { "lm",			/* Objective lex file */
     "m",			/* Objective C file */
      NULL };
-static char Objc_help [] =
+static const char Objc_help [] =
 "In Objective C code, tags include Objective C definitions for classes,\n\
 class categories, methods and protocols.  Tags for variables and\n\
 functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'.\n\
 (Use --help --lang=c --lang=objc --lang=java for full help.)";
 
-static char *Pascal_suffixes [] =
+static const char *Pascal_suffixes [] =
   { "p", "pas", NULL };
-static char Pascal_help [] =
+static const char Pascal_help [] =
 "In Pascal code, the tags are the functions and procedures defined\n\
 in the file.";
 /* " // this is for working around an Emacs highlighting bug... */
 
-static char *Perl_suffixes [] =
+static const char *Perl_suffixes [] =
   { "pl", "pm", NULL };
-static char *Perl_interpreters [] =
+static const char *Perl_interpreters [] =
   { "perl", "@PERL@", NULL };
-static char Perl_help [] =
+static const char Perl_help [] =
 "In Perl code, the tags are the packages, subroutines and variables\n\
 defined by the `package', `sub', `my' and `local' keywords.  Use\n\
 `--globals' if you want to tag global variables.  Tags for\n\
 subroutines are named `PACKAGE::SUB'.  The name for subroutines\n\
 defined in the default package is `main::SUB'.";
 
-static char *PHP_suffixes [] =
+static const char *PHP_suffixes [] =
   { "php", "php3", "php4", NULL };
-static char PHP_help [] =
+static const char PHP_help [] =
 "In PHP code, tags are functions, classes and defines.  Unless you use\n\
 the `--no-members' option, vars are tags too.";
 
-static char *plain_C_suffixes [] =
+static const char *plain_C_suffixes [] =
   { "pc",			/* Pro*C file */
      NULL };
 
-static char *PS_suffixes [] =
+static const char *PS_suffixes [] =
   { "ps", "psw", NULL };	/* .psw is for PSWrap */
-static char PS_help [] =
+static const char PS_help [] =
 "In PostScript code, the tags are the functions.";
 
-static char *Prolog_suffixes [] =
+static const char *Prolog_suffixes [] =
   { "prolog", NULL };
-static char Prolog_help [] =
+static const char Prolog_help [] =
 "In Prolog code, tags are predicates and rules at the beginning of\n\
 line.";
 
-static char *Python_suffixes [] =
+static const char *Python_suffixes [] =
   { "py", NULL };
-static char Python_help [] =
+static const char Python_help [] =
 "In Python code, `def' or `class' at the beginning of a line\n\
 generate a tag.";
 
 /* Can't do the `SCM' or `scm' prefix with a version number. */
-static char *Scheme_suffixes [] =
+static const char *Scheme_suffixes [] =
   { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL };
-static char Scheme_help [] =
+static const char Scheme_help [] =
 "In Scheme code, tags include anything defined with `def' or with a\n\
 construct whose name starts with `def'.  They also include\n\
 variables set with `set!' at top level in the file.";
 
-static char *TeX_suffixes [] =
+static const char *TeX_suffixes [] =
   { "bib", "clo", "cls", "ltx", "sty", "TeX", "tex", NULL };
-static char TeX_help [] =
+static const char TeX_help [] =
 "In LaTeX text, the argument of any of the commands `\\chapter',\n\
 `\\section', `\\subsection', `\\subsubsection', `\\eqno', `\\label',\n\
 `\\ref', `\\cite', `\\bibitem', `\\part', `\\appendix', `\\entry',\n\
@@ -781,28 +781,28 @@
      TEXTAGS=\"mycommand:myothercommand\".";
 
 
-static char *Texinfo_suffixes [] =
+static const char *Texinfo_suffixes [] =
   { "texi", "texinfo", "txi", NULL };
-static char Texinfo_help [] =
+static const char Texinfo_help [] =
 "for texinfo files, lines starting with @node are tagged.";
 
-static char *Yacc_suffixes [] =
+static const char *Yacc_suffixes [] =
   { "y", "y++", "ym", "yxx", "yy", NULL }; /* .ym is Objective yacc file */
-static char Yacc_help [] =
+static const char Yacc_help [] =
 "In Bison or Yacc input files, each rule defines as a tag the\n\
 nonterminal it constructs.  The portions of the file that contain\n\
 C code are parsed as C code (use --help --lang=c --lang=yacc\n\
 for full help).";
 
-static char auto_help [] =
+static const char auto_help [] =
 "`auto' is not a real language, it indicates to use\n\
 a default language for files base on file name suffix and file contents.";
 
-static char none_help [] =
+static const char none_help [] =
 "`none' is not a real language, it indicates to only do\n\
 regexp processing on files.";
 
-static char no_lang_help [] =
+static const char no_lang_help [] =
 "No detailed help available for this language.";
 
 
@@ -851,7 +851,7 @@
 print_language_names (void)
 {
   language *lang;
-  char **name, **ext;
+  const char **name, **ext;
 
   puts ("\nThese are the currently supported languages, along with the\n\
 default file names and dot suffixes:");
@@ -1467,7 +1467,7 @@
 get_language_from_interpreter (char *interpreter)
 {
   language *lang;
-  char **iname;
+  const char **iname;
 
   if (interpreter == NULL)
     return NULL;
@@ -1489,7 +1489,7 @@
 get_language_from_filename (char *file, int case_sensitive)
 {
   language *lang;
-  char **name, **ext, *suffix;
+  const char **name, **ext, *suffix;
 
   /* Try whole file name first. */
   for (lang = lang_names; lang->name != NULL; lang++)
@@ -1721,7 +1721,7 @@
 static void
 init (void)
 {
-  register char *sp;
+  register const char *sp;
   register int i;
 
   for (i = 0; i < CHARS; i++)
@@ -1900,23 +1900,23 @@
  * etags.el needs to use the same characters that are in NONAM.
  */
 static void
-make_tag (char *name, int namelen, int is_func, char *linestart, int linelen, int lno, long int cno)
-                		/* tag name, or NULL if unnamed */
-                 		/* tag length */
-                  		/* tag is a function */
-                     		/* start of the line where tag is */
-                 		/* length of the line where tag is */
-             			/* line number */
-              			/* character number */
+make_tag (const char *name, 	/* tag name, or NULL if unnamed */
+	  int namelen,		/* tag length */
+	  int is_func,		/* tag is a function */
+	  char *linestart,	/* start of the line where tag is */
+	  int linelen,          /* length of the line where tag is */
+	  int lno,		/* line number */
+	  long int cno)		/* character number */
 {
   bool named = (name != NULL && namelen > 0);
+  char *nname = NULL;
 
   if (!CTAGS && named)		/* maybe set named to false */
     /* Let's try to make an implicit tag name, that is, create an unnamed tag
        such that etags.el can guess a name from it. */
     {
       int i;
-      register char *cp = name;
+      register const char *cp = name;
 
       for (i = 0; i < namelen; i++)
 	if (notinname (*cp++))
@@ -1935,10 +1935,9 @@
     }
 
   if (named)
-    name = savenstr (name, namelen);
-  else
-    name = NULL;
-  pfnote (name, is_func, linestart, linelen, lno, cno);
+    nname = savenstr (name, namelen);
+
+  pfnote (nname, is_func, linestart, linelen, lno, cno);
 }
 
 /* Record a tag. */
@@ -2361,7 +2360,7 @@
 /* Command-line: gperf -m 5  */
 /* Computed positions: -k'2-3' */
 
-struct C_stab_entry { char *name; int c_ext; enum sym_type type; };
+struct C_stab_entry { const char *name; int c_ext; enum sym_type type; };
 /* maximum key range = 33, duplicates = 0 */
 
 #ifdef __GNUC__
@@ -2550,7 +2549,7 @@
 /*
  * When objdef is different from onone, objtag is the name of the class.
  */
-static char *objtag = "<uninited>";
+static const char *objtag = "<uninited>";
 
 /*
  * Yet another little state machine to deal with preprocessor lines.
@@ -2613,7 +2612,7 @@
  */
 static void pushclass_above (int, char *, int);
 static void popclass_above (int);
-static void write_classname (linebuffer *, char *qualifier);
+static void write_classname (linebuffer *, const char *qualifier);
 
 static struct {
   char **cname;			/* nested class names */
@@ -2661,7 +2660,7 @@
 }
 
 static void
-write_classname (linebuffer *cn, char *qualifier)
+write_classname (linebuffer *cn, const char *qualifier)
 {
   int i, len;
   int qlen = strlen (qualifier);
@@ -3092,7 +3091,7 @@
   int curndx, newndx;		/* indices for current and new lb */
   register int tokoff;		/* offset in line of start of current token */
   register int toklen;		/* length of current token */
-  char *qualifier;		/* string used to qualify names */
+  const char *qualifier;        /* string used to qualify names */
   int qlen;			/* length of qualifier */
   int bracelev;			/* current brace level */
   int bracketlev;		/* current bracket level */
@@ -4127,12 +4126,10 @@
  * Philippe Waroquiers (1998)
  */
 
-static void Ada_getit (FILE *, char *);
-
 /* Once we are positioned after an "interesting" keyword, let's get
    the real tag value necessary. */
 static void
-Ada_getit (FILE *inf, char *name_qualifier)
+Ada_getit (FILE *inf, const char *name_qualifier)
 {
   register char *cp;
   char *name;
@@ -4961,13 +4958,13 @@
 
 /* Default set of control sequences to put into TEX_toktab.
    The value of environment var TEXTAGS is prepended to this.  */
-static char *TEX_defenv = "\
+static const char *TEX_defenv = "\
 :chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem\
 :part:appendix:entry:index:def\
 :newcommand:renewcommand:newenvironment:renewenvironment";
 
 static void TEX_mode (FILE *);
-static void TEX_decode_env (char *, char *);
+static void TEX_decode_env (const char *, const char *);
 
 static char TEX_esc = '\\';
 static char TEX_opgrp = '{';
@@ -5075,9 +5072,9 @@
 /* Read environment and prepend it to the default string.
    Build token table. */
 static void
-TEX_decode_env (char *evarname, char *defenv)
+TEX_decode_env (const char *evarname, const char *defenv)
 {
-  register char *env, *p;
+  register const char *env, *p;
   int i, len;
 
   /* Append default string to environment. */
@@ -5085,10 +5082,7 @@
   if (!env)
     env = defenv;
   else
-    {
-      char *oldenv = env;
-      env = concat (oldenv, defenv, "");
-    }
+    env = concat (env, defenv, "");
 
   /* Allocate a token table */
   for (len = 1, p = env; p;)
@@ -5713,6 +5707,7 @@
 {
   static struct re_pattern_buffer zeropattern;
   char sep, *pat, *name, *modifiers;
+  char empty[] = "";
   const char *err;
   struct re_pattern_buffer *patbuf;
   regexp *rp;
@@ -5744,7 +5739,7 @@
   if (modifiers == NULL)	/* no terminating separator --> no name */
     {
       modifiers = name;
-      name = "";
+      name = empty;
     }
   else
     modifiers += 1;		/* skip separator */
@@ -5972,7 +5967,7 @@
 
 
 static bool
-nocase_tail (char *cp)
+nocase_tail (const char *cp)
 {
   register int len = 0;
 
@@ -6289,7 +6284,7 @@
  * with xnew where the string CP has been copied.
  */
 static char *
-savestr (char *cp)
+savestr (const char *cp)
 {
   return savenstr (cp, strlen (cp));
 }
@@ -6299,7 +6294,7 @@
  * the string CP has been copied for at most the first LEN characters.
  */
 static char *
-savenstr (char *cp, int len)
+savenstr (const char *cp, int len)
 {
   register char *dp;
 
@@ -6408,14 +6403,14 @@
 
 /* Print error message and exit.  */
 void
-fatal (char *s1, char *s2)
+fatal (const char *s1, const char *s2)
 {
   error (s1, s2);
   exit (EXIT_FAILURE);
 }
 
 static void
-pfatal (char *s1)
+pfatal (const char *s1)
 {
   perror (s1);
   exit (EXIT_FAILURE);
@@ -6441,7 +6436,7 @@
 /* Return a newly-allocated string whose contents
    concatenate those of s1, s2, s3.  */
 static char *
-concat (char *s1, char *s2, char *s3)
+concat (const char *s1, const char *s2, const char *s3)
 {
   int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
   char *result = xnew (len1 + len2 + len3 + 1, char);
--- a/lib-src/fakemail.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/lib-src/fakemail.c	Sun Aug 15 22:50:44 2010 +0000
@@ -30,7 +30,7 @@
 #if defined (BSD_SYSTEM) && !defined (USE_FAKEMAIL)
 /* This program isnot used in BSD, so just avoid loader complaints.  */
 int
-main ()
+main (void)
 {
   return 0;
 }
@@ -59,6 +59,7 @@
 #include <ctype.h>
 #include <time.h>
 #include <pwd.h>
+#include <stdlib.h>
 
 /* This is to declare cuserid.  */
 #ifdef HAVE_UNISTD_H
@@ -140,21 +141,16 @@
 #define MAIL_PROGRAM_NAME "/bin/mail"
 #endif
 
-static char *my_name;
+static const char *my_name;
 static char *the_date;
 static char *the_user;
 static line_list file_preface;
 static stream_list the_streams;
 static boolean no_problems = true;
 
-static void fatal (char *s1) NO_RETURN;
-
-extern FILE *popen (const char *, const char *);
-extern int fclose (FILE *), pclose (FILE *);
+static void fatal (const char *s1) NO_RETURN;
 
 #ifdef CURRENT_USER
-extern struct passwd *getpwuid ();
-extern unsigned short geteuid ();
 static struct passwd *my_entry;
 #define cuserid(s)				\
 (my_entry = getpwuid (((int) geteuid ())),	\
@@ -166,7 +162,7 @@
 /* Print error message.  `s1' is printf control string, `s2' is arg for it. */
 
 static void
-error (char *s1, char *s2)
+error (const char *s1, const char *s2)
 {
   printf ("%s: ", my_name);
   printf (s1, s2);
@@ -177,7 +173,7 @@
 /* Print error message and exit.  */
 
 static void
-fatal (char *s1)
+fatal (const char *s1)
 {
   error ("%s", s1);
   exit (EXIT_FAILURE);
@@ -464,20 +460,20 @@
 }
 
 void
-put_line (char *string)
+put_line (const char *string)
 {
   register stream_list rem;
   for (rem = the_streams;
        rem != ((stream_list) NULL);
        rem = rem->rest_streams)
     {
-      char *s = string;
+      const char *s = string;
       int column = 0;
 
       /* Divide STRING into lines.  */
       while (*s != 0)
 	{
-	  char *breakpos;
+	  const char *breakpos;
 
 	  /* Find the last char that fits.  */
 	  for (breakpos = s; *breakpos && column < 78; ++breakpos)
@@ -699,13 +695,11 @@
   char *command_line;
   header the_header;
   long name_length;
-  char *mail_program_name;
+  const char *mail_program_name;
   char buf[BUFLEN + 1];
   register int size;
   FILE *the_pipe;
 
-  extern char *getenv (const char *);
-
   mail_program_name = getenv ("FAKEMAILER");
   if (!(mail_program_name && *mail_program_name))
     mail_program_name = MAIL_PROGRAM_NAME;
--- a/lib-src/make-docfile.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/lib-src/make-docfile.c	Sun Aug 15 22:50:44 2010 +0000
@@ -68,9 +68,9 @@
 #endif
 
 int scan_file (char *filename);
-int scan_lisp_file (char *filename, char *mode);
-int scan_c_file (char *filename, char *mode);
-void fatal (char *s1, char *s2) NO_RETURN;
+int scan_lisp_file (const char *filename, const char *mode);
+int scan_c_file (char *filename, const char *mode);
+void fatal (const char *s1, const char *s2) NO_RETURN;
 
 #ifdef MSDOS
 /* s/msdos.h defines this as sys_chdir, but we're not linking with the
@@ -92,7 +92,7 @@
 
 /* VARARGS1 */
 void
-error (char *s1, char *s2)
+error (const char *s1, const char *s2)
 {
   fprintf (stderr, "%s: ", progname);
   fprintf (stderr, s1, s2);
@@ -103,7 +103,7 @@
 
 /* VARARGS1 */
 void
-fatal (char *s1, char *s2)
+fatal (const char *s1, const char *s2)
 {
   error (s1, s2);
   exit (EXIT_FAILURE);
@@ -233,10 +233,10 @@
 
   /* A keyword we look for at the beginning of lines.  If found, it is
      not copied, and SAW_KEYWORD is set to true.  */
-  char *keyword;
+  const char *keyword;
   /* The current point we've reached in an occurrence of KEYWORD in
      the input stream.  */
-  char *cur_keyword_ptr;
+  const char *cur_keyword_ptr;
   /* Set to true if we saw an occurrence of KEYWORD.  */
   int saw_keyword;
 };
@@ -326,7 +326,7 @@
 	   keyword, but it was a false alarm.  Output the
 	   part we scanned.  */
 	{
-	  char *p;
+	  const char *p;
 
 	  for (p = state->keyword; p < state->cur_keyword_ptr; p++)
 	    put_char (*p, state);
@@ -521,7 +521,7 @@
    Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED.  */
 
 int
-scan_c_file (char *filename, char *mode)
+scan_c_file (char *filename, const char *mode)
 {
   FILE *infile;
   register int c;
@@ -834,7 +834,7 @@
 }
 
 int
-scan_lisp_file (char *filename, char *mode)
+scan_lisp_file (const char *filename, const char *mode)
 {
   FILE *infile;
   register int c;
--- a/lib-src/movemail.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/lib-src/movemail.c	Sun Aug 15 22:50:44 2010 +0000
@@ -147,11 +147,11 @@
 char *strerror (int);
 #endif
 
-static void fatal (char *s1, char *s2, char *s3) NO_RETURN;
-static void error (char *s1, char *s2, char *s3);
+static void fatal (const char *s1, const char *s2, const char *s3) NO_RETURN;
+static void error (const char *s1, const char *s2, const char *s3);
 static void pfatal_with_name (char *name) NO_RETURN;
 static void pfatal_and_delete (char *name) NO_RETURN;
-static char *concat (char *s1, char *s2, char *s3);
+static char *concat (const char *s1, const char *s2, const char *s3);
 static long *xmalloc (unsigned int size);
 #ifdef MAIL_USE_POP
 static int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order);
@@ -589,7 +589,7 @@
 /* Print error message and exit.  */
 
 static void
-fatal (char *s1, char *s2, char *s3)
+fatal (const char *s1, const char *s2, const char *s3)
 {
   if (delete_lockname)
     unlink (delete_lockname);
@@ -601,7 +601,7 @@
    are args for it or null. */
 
 static void
-error (char *s1, char *s2, char *s3)
+error (const char *s1, const char *s2, const char *s3)
 {
   fprintf (stderr, "movemail: ");
   if (s3)
@@ -630,7 +630,7 @@
 /* Return a newly-allocated string whose contents concatenate those of s1, s2, s3.  */
 
 static char *
-concat (char *s1, char *s2, char *s3)
+concat (const char *s1, const char *s2, const char *s3)
 {
   int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
   char *result = (char *) xmalloc (len1 + len2 + len3 + 1);
--- a/lib-src/pop.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/lib-src/pop.c	Sun Aug 15 22:50:44 2010 +0000
@@ -110,7 +110,7 @@
 
 static int socket_connection (char *, int);
 static int pop_getline (popserver, char **);
-static int sendline (popserver, char *);
+static int sendline (popserver, const char *);
 static int fullwrite (int, char *, int);
 static int getok (popserver);
 #if 0
@@ -676,7 +676,7 @@
 }
 
 int
-pop_multi_first (popserver server, char *command, char **response)
+pop_multi_first (popserver server, const char *command, char **response)
 {
   if (server->in_multi)
     {
@@ -988,7 +988,7 @@
   struct servent *servent;
   struct sockaddr_in addr;
   char found_port = 0;
-  char *service;
+  const char *service;
   int sock;
   char *realhost;
 #ifdef KERBEROS
@@ -1414,7 +1414,7 @@
  * Side effects: Closes the connection on error.
  */
 static int
-sendline (popserver server, char *line)
+sendline (popserver server, const char *line)
 {
 #define SENDLINE_ERROR "Error writing to POP server: "
   int ret;
--- a/lib-src/pop.h	Wed Aug 11 03:20:07 2010 +0000
+++ b/lib-src/pop.h	Sun Aug 15 22:50:44 2010 +0000
@@ -49,39 +49,31 @@
 #define POP_NO_HESIOD	(1<<1)
 #define POP_NO_GETPASS 	(1<<2)
 
-#ifdef __STDC__
-#define _ARGS(a) a
-#else
-#define _ARGS(a) ()
-#endif
-
-extern popserver pop_open _ARGS((char *host, char *username, char *password,
-				 int flags));
-extern int pop_stat _ARGS((popserver server, int *count, int *size));
-extern int pop_list _ARGS((popserver server, int message, int **IDs,
-			   int **size));
-extern int pop_retrieve _ARGS((popserver server, int message, int markfrom,
-			       char **));
-extern int pop_retrieve_first _ARGS((popserver server, int message,
-				     char **response));
-extern int pop_retrieve_next _ARGS((popserver server, char **line));
-extern int pop_retrieve_flush _ARGS((popserver server));
-extern int pop_top_first _ARGS((popserver server, int message, int lines,
-				char **response));
-extern int pop_top_next _ARGS((popserver server, char **line));
-extern int pop_top_flush _ARGS((popserver server));
-extern int pop_multi_first _ARGS((popserver server, char *command,
-				  char **response));
-extern int pop_multi_next _ARGS((popserver server, char **line));
-extern int pop_multi_flush _ARGS((popserver server));
-extern int pop_delete _ARGS((popserver server, int message));
-extern int pop_noop _ARGS((popserver server));
-extern int pop_last _ARGS((popserver server));
-extern int pop_reset _ARGS((popserver server));
-extern int pop_quit _ARGS((popserver server));
-extern void pop_close _ARGS((popserver));
-
-#undef _ARGS
+extern popserver pop_open (char *host, char *username, char *password,
+                           int flags);
+extern int pop_stat (popserver server, int *count, int *size);
+extern int pop_list (popserver server, int message, int **IDs,
+                     int **size);
+extern int pop_retrieve (popserver server, int message, int markfrom,
+                         char **);
+extern int pop_retrieve_first (popserver server, int message,
+                               char **response);
+extern int pop_retrieve_next (popserver server, char **line);
+extern int pop_retrieve_flush (popserver server);
+extern int pop_top_first (popserver server, int message, int lines,
+                          char **response);
+extern int pop_top_next (popserver server, char **line);
+extern int pop_top_flush (popserver server);
+extern int pop_multi_first (popserver server, const char *command,
+                            char **response);
+extern int pop_multi_next (popserver server, char **line);
+extern int pop_multi_flush (popserver server);
+extern int pop_delete (popserver server, int message);
+extern int pop_noop (popserver server);
+extern int pop_last (popserver server);
+extern int pop_reset (popserver server);
+extern int pop_quit (popserver server);
+extern void pop_close (popserver);
 
 /* arch-tag: 76cc5f58-8e86-48fa-bc72-a7c6cb1c4f1c
    (do not change this comment) */
--- a/lib-src/sorted-doc.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/lib-src/sorted-doc.c	Sun Aug 15 22:50:44 2010 +0000
@@ -65,7 +65,7 @@
 /* Print error message.  `s1' is printf control string, `s2' is arg for it. */
 
 void
-error (char *s1, char *s2)
+error (const char *s1, const char *s2)
 {
   fprintf (stderr, "sorted-doc: ");
   fprintf (stderr, s1, s2);
@@ -75,7 +75,7 @@
 /* Print error message and exit.  */
 
 void
-fatal (char *s1, char *s2)
+fatal (const char *s1, const char *s2)
 {
   error (s1, s2);
   exit (EXIT_FAILURE);
@@ -117,7 +117,7 @@
   WAITING, BEG_NAME, NAME_GET, BEG_DESC, DESC_GET
 };
 
-char *states[] =
+const char *states[] =
 {
   "WAITING", "BEG_NAME", "NAME_GET", "BEG_DESC", "DESC_GET"
 };
--- a/lib-src/update-game-score.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/lib-src/update-game-score.c	Sun Aug 15 22:50:44 2010 +0000
@@ -157,8 +157,8 @@
   return buf->pw_name;
 }
 
-char *
-get_prefix (int running_suid, char *user_prefix)
+const char *
+get_prefix (int running_suid, const char *user_prefix)
 {
   if (!running_suid && user_prefix == NULL)
     lose ("Not using a shared game directory, and no prefix given.");
@@ -178,7 +178,8 @@
 {
   int c, running_suid;
   void *lockstate;
-  char *user_id, *scorefile, *prefix, *user_prefix = NULL;
+  char *user_id, *scorefile;
+  const char *prefix, *user_prefix = NULL;
   struct stat buf;
   struct score_entry *scores;
   int newscore, scorecount, reverse = 0, max = MAX_SCORES;
@@ -451,7 +452,7 @@
   int fd;
   struct stat buf;
   int attempts = 0;
-  char *lockext = ".lockfile";
+  const char *lockext = ".lockfile";
   char *lockpath = malloc (strlen (filename) + strlen (lockext) + 60);
   if (!lockpath)
     return -1;
--- a/lisp/ChangeLog	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/ChangeLog	Sun Aug 15 22:50:44 2010 +0000
@@ -1,11 +1,87 @@
+2010-08-15  Chong Yidong  <cyd@stupidchicken.com>
+
+	* progmodes/compile.el (compilation-error-regexp-alist-alist):
+	Give the Ruby rule a lower priority than Gnu (Bug#6778).
+
+2010-08-14  Štěpán Němec  <stepnem@gmail.com>  (tiny change)
+
+	* font-lock.el (lisp-font-lock-keywords-2): Add
+	combine-after-change-calls, condition-case-no-debug,
+	with-demoted-errors, and with-silent-modifications (Bug#6025).
+
+2010-08-14  Kevin Ryde  <user42@zip.com.au>
+
+	* emacs-lisp/copyright.el (copyright-update-year)
+	(copyright-update): Temporary switch-to-buffer to ensure the
+	buffer change being queried is visible (Bug#5394).
+
+2010-08-14  Tom Tromey  <tromey@redhat.com>
+
+	* progmodes/etags.el (tags-file-name): Mark safe if stringp
+	(Bug#6733).
+
+2010-08-14  Eli Zaretskii  <eliz@gnu.org>
+
+	* mouse.el (mouse-yank-primary): Fix mouse-2 on MS-Windows and
+	MS-DOS.  (Bug#6689)
+
+2010-08-13  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* menu-bar.el (menu-bar-set-tool-bar-position): New function.
+	(menu-bar-showhide-tool-bar-menu-customize-enable-left)
+	(menu-bar-showhide-tool-bar-menu-customize-enable-right)
+	(menu-bar-showhide-tool-bar-menu-customize-enable-top)
+	(menu-bar-showhide-tool-bar-menu-customize-enable-bottom): Call
+	menu-bar-set-tool-bar-position.
+
+2010-08-12  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/octave-mod.el (octave-mode-syntax-table): Use the new "c"
+	comment style (bug#6834).
+	* progmodes/scheme.el (scheme-mode-syntax-table):
+	* emacs-lisp/lisp-mode.el (lisp-mode-syntax-table): Remove spurious
+	"b" flag in "' 14b" syntax.
+
+	* progmodes/octave-mod.el (octave-mode-map): Remove special bindings
+	for (un)commenting the region and performing completion.
+	(octave-mode-menu): Use standard commands for help and completion.
+	(octave-mode-syntax-table): Support %{..%} comments (sort of).
+	(octave-mode): Use define-derived-mode.
+	Set completion-at-point-functions and don't set columns.
+	Don't disable adaptive-fill-regexp.
+	(octave-describe-major-mode, octave-comment-region)
+	(octave-uncomment-region, octave-comment-indent)
+	(octave-indent-for-comment): Remove.
+	(octave-indent-calculate): Rename from calculate-octave-indent.
+	(octave-indent-line, octave-fill-paragraph): Update caller.
+	(octave-initialize-completions): No need to make an alist.
+	(octave-completion-at-point-function): New function.
+	(octave-complete-symbol): Use it.
+	(octave-insert-defun): Use define-skeleton.
+
+	* progmodes/octave-mod.el (octave-mode): Set comment-add.
+	(octave-mode-map): Use comment-dwim (bug#6829).
+
+2010-08-12  Antoine Levitt  <antoine.levitt@gmail.com>  (tiny change)
+
+	* cus-edit.el (custom-save-variables, custom-save-faces): Fix up
+	indentation of inserted comment.
+
+2010-08-11  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* faces.el (region): Add type gtk that uses gtk colors.
+
+	* dynamic-setting.el (dynamic-setting-handle-config-changed-event):
+	Handle theme-name change.
+
 2010-08-10  Michael R. Mauger  <mmaug@yahoo.com>
 
 	* progmodes/sql.el: Version 2.5
 	(sql-product-alist): Add :prompt-cont-regexp property for several
 	database products.
 	(sql-prompt-cont-regexp): New variable.
-	(sql-output-newline-count, sql-output-by-send): New
-	variables. Record number of newlines in input text.
+	(sql-output-newline-count, sql-output-by-send):
+	New variables.  Record number of newlines in input text.
 	(sql-send-string): Handle multiple filters and count newlines.
 	(sql-send-magic-terminator): Count terminator newline.
 	(sql-interactive-remove-continuation-prompt): Filters output to
@@ -13,8 +89,7 @@
 	(sql-interactive-mode): Set up new variables, prompt regexp and
 	output filter.
 	(sql-mode-sqlite-font-lock-keywords): Correct some keywords.
-	(sql-make-alternate-buffer-name): Correct buffer name in edge
-	cases.
+	(sql-make-alternate-buffer-name): Correct buffer name in edge cases.
 
 2010-08-10  Stefan Monnier  <monnier@iro.umontreal.ca>
 
--- a/lisp/cus-edit.el	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/cus-edit.el	Sun Aug 15 22:50:44 2010 +0000
@@ -4404,10 +4404,10 @@
       (unless (bolp)
 	(princ "\n"))
       (princ "(custom-set-variables
-  ;; custom-set-variables was added by Custom.
-  ;; If you edit it by hand, you could mess it up, so be careful.
-  ;; Your init file should contain only one such instance.
-  ;; If there is more than one, they won't work right.\n")
+ ;; custom-set-variables was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.\n")
       (dolist (symbol saved-list)
 	(let ((spec (car-safe (get symbol 'theme-value)))
 	      (value (get symbol 'saved-value))
@@ -4480,10 +4480,10 @@
       (unless (bolp)
 	(princ "\n"))
       (princ "(custom-set-faces
-  ;; custom-set-faces was added by Custom.
-  ;; If you edit it by hand, you could mess it up, so be careful.
-  ;; Your init file should contain only one such instance.
-  ;; If there is more than one, they won't work right.\n")
+ ;; custom-set-faces was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.\n")
       (dolist (symbol saved-list)
 	(let ((spec (car-safe (get symbol 'theme-face)))
 	      (value (get symbol 'saved-face))
--- a/lisp/dynamic-setting.el	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/dynamic-setting.el	Sun Aug 15 22:50:44 2010 +0000
@@ -96,6 +96,11 @@
 	  ((eq type 'font-render)
 	   (font-setting-change-default-font display-name nil))
 
+	  ;; This is a bit heavy, ideally we would just clear faces
+	  ;; on the affected display, and perhaps only the relevant
+	  ;; faces.  Oh well.
+	  ((eq type 'theme-name) (clear-face-cache))
+
 	  ((eq type 'tool-bar-style) (force-mode-line-update t)))))
 
 (define-key special-event-map [config-changed-event]
--- a/lisp/emacs-lisp/copyright.el	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/emacs-lisp/copyright.el	Sun Aug 15 22:50:44 2010 +0000
@@ -158,13 +158,15 @@
     (unless (string= (buffer-substring (- (match-end 3) 2) (match-end 3))
 		     (substring copyright-current-year -2))
       (if (or noquery
-	      ;; Fixes some point-moving oddness (bug#2209).
-	      (save-excursion
-		(y-or-n-p (if replace
-			      (concat "Replace copyright year(s) by "
-				      copyright-current-year "? ")
-			    (concat "Add " copyright-current-year
-				    " to copyright? ")))))
+	      (save-window-excursion
+		(switch-to-buffer (current-buffer))
+		;; Fixes some point-moving oddness (bug#2209).
+		(save-excursion
+		  (y-or-n-p (if replace
+				(concat "Replace copyright year(s) by "
+					copyright-current-year "? ")
+			      (concat "Add " copyright-current-year
+				      " to copyright? "))))))
 	  (if replace
 	      (replace-match copyright-current-year t t nil 3)
 	    (let ((size (save-excursion (skip-chars-backward "0-9"))))
@@ -224,8 +226,10 @@
                   (string-to-number copyright-current-gpl-version))
 	       (or noquery
                    (save-match-data
-                     (y-or-n-p (format "Replace GPL version by %s? "
-                                       copyright-current-gpl-version))))
+		     (save-window-excursion
+		       (switch-to-buffer (current-buffer))
+		       (y-or-n-p (format "Replace GPL version by %s? "
+					 copyright-current-gpl-version)))))
 	       (progn
 		 (if (match-end 2)
 		     ;; Esperanto bilingual comment in two-column.el
--- a/lisp/emacs-lisp/lisp-mode.el	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/emacs-lisp/lisp-mode.el	Sun Aug 15 22:50:44 2010 +0000
@@ -85,7 +85,7 @@
   (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table)))
     (modify-syntax-entry ?\[ "_   " table)
     (modify-syntax-entry ?\] "_   " table)
-    (modify-syntax-entry ?# "' 14b" table)
+    (modify-syntax-entry ?# "' 14" table)
     (modify-syntax-entry ?| "\" 23bn" table)
     table)
   "Syntax table used in `lisp-mode'.")
--- a/lisp/erc/ChangeLog	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/erc/ChangeLog	Sun Aug 15 22:50:44 2010 +0000
@@ -1,3 +1,10 @@
+2010-08-14  Vivek Dasmohapatra  <vivek@etla.org>
+
+	* erc-join.el (erc-autojoin-timing, erc-autojoin-delay): New vars.
+	(erc-autojoin-channels-delayed, erc-autojoin-after-ident): New
+	functions.
+	(erc-autojoin-channels): Allow autojoining after ident (Bug#5521).
+
 2010-08-08  Fran Litterio  <flitterio@gmail.com>
 
 	* erc-backend.el (erc-server-filter-function): Call
--- a/lisp/erc/erc-join.el	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/erc/erc-join.el	Sun Aug 15 22:50:44 2010 +0000
@@ -42,9 +42,11 @@
 (define-erc-module autojoin nil
   "Makes ERC autojoin on connects and reconnects."
   ((add-hook 'erc-after-connect 'erc-autojoin-channels)
+   (add-hook 'erc-nickserv-identified-hook 'erc-autojoin-after-ident)
    (add-hook 'erc-server-JOIN-functions 'erc-autojoin-add)
    (add-hook 'erc-server-PART-functions 'erc-autojoin-remove))
   ((remove-hook 'erc-after-connect 'erc-autojoin-channels)
+   (remove-hook 'erc-nickserv-identified-hook 'erc-autojoin-after-ident)
    (remove-hook 'erc-server-JOIN-functions 'erc-autojoin-add)
    (remove-hook 'erc-server-PART-functions 'erc-autojoin-remove)))
 
@@ -66,6 +68,24 @@
 		       (repeat :tag "Channels"
 			       (string :tag "Name")))))
 
+(defcustom erc-autojoin-timing 'connect
+  "When ERC should attempt to autojoin a channel.
+If the value is `connect', autojoin immediately on connecting.
+If the value is `ident', autojoin after successful NickServ
+identification, or after `erc-autojoin-delay' seconds.
+Any other value means the same as `connect'."
+  :group 'erc-autojoin
+  :type  '(choice (const :tag "On Connection" 'connect)
+		  (const :tag "When Identified" 'ident)))
+
+(defcustom erc-autojoin-delay 30
+  "Number of seconds to wait before attempting to autojoin channels.
+This only takes effect if `erc-autojoin-timing' is `ident'.
+If NickServ identification occurs before this delay expires, ERC
+autojoins immediately at that time."
+  :group 'erc-autojoin
+  :type  'integer)
+
 (defcustom erc-autojoin-domain-only t
   "Truncate host name to the domain name when joining a server.
 If non-nil, and a channel on the server a.b.c is joined, then
@@ -75,12 +95,60 @@
   :group 'erc-autojoin
   :type 'boolean)
 
+(defvar erc--autojoin-timer nil)
+(make-variable-buffer-local 'erc--autojoin-timer)
+
+(defun erc-autojoin-channels-delayed (server nick buffer)
+  "Attempt to autojoin channels.
+This is called from a timer set up by `erc-autojoin-channels'."
+  (if erc--autojoin-timer
+      (setq erc--autojoin-timer
+	    (erc-cancel-timer erc--autojoin-timer)))
+  (with-current-buffer buffer
+    ;; Don't kick of another delayed autojoin or try to wait for
+    ;; another ident response:
+    (let ((erc-autojoin-delay -1)
+	  (erc-autojoin-timing 'connect))
+      (erc-log "Delayed autojoin started (no ident success detected yet)")
+      (erc-autojoin-channels server nick))))
+
+(defun erc-autojoin-after-ident (network nick)
+  "Autojoin channels in `erc-autojoin-channels-alist'.
+This function is run from `erc-nickserv-identified-hook'."
+  (if erc--autojoin-timer
+      (setq erc--autojoin-timer
+	    (erc-cancel-timer erc--autojoin-timer)))
+  (when (eq erc-autojoin-timing 'ident)
+    (let ((server (or erc-server-announced-name erc-session-server))
+	  (joined (mapcar (lambda (buf)
+			    (with-current-buffer buf (erc-default-target)))
+			  (erc-channel-list erc-server-process))))
+      ;; We may already be in these channels, e.g. because the
+      ;; autojoin timer went off.
+      (dolist (l erc-autojoin-channels-alist)
+	(when (string-match (car l) server)
+	  (dolist (chan (cdr l))
+	    (unless (erc-member-ignore-case chan joined)
+	      (erc-server-send (concat "join " chan))))))))
+  nil)
+
 (defun erc-autojoin-channels (server nick)
   "Autojoin channels in `erc-autojoin-channels-alist'."
-  (dolist (l erc-autojoin-channels-alist)
-    (when (string-match (car l) server)
-      (dolist (chan (cdr l))
-	(erc-server-send (concat "join " chan))))))
+  (if (eq erc-autojoin-timing 'ident)
+      ;; Prepare the delayed autojoin timer, in case ident doesn't
+      ;; happen within the allotted time limit:
+      (when (> erc-autojoin-delay 0)
+	(setq erc--autojoin-timer
+	      (run-with-timer erc-autojoin-delay nil
+			      'erc-autojoin-channels-delayed
+			      server nick (current-buffer))))
+    ;; `erc-autojoin-timing' is `connect':
+    (dolist (l erc-autojoin-channels-alist)
+      (when (string-match (car l) server)
+	(dolist (chan (cdr l))
+	  (erc-server-send (concat "join " chan))))))
+  ;; Return nil to avoid stomping on any other hook funcs.
+  nil)
 
 (defun erc-autojoin-add (proc parsed)
   "Add the channel being joined to `erc-autojoin-channels-alist'."
--- a/lisp/faces.el	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/faces.el	Sun Aug 15 22:50:44 2010 +0000
@@ -2281,6 +2281,9 @@
 (defface region
   '((((class color) (min-colors 88) (background dark))
      :background "blue3")
+    (((class color) (min-colors 88) (background light) (type gtk))
+     :foreground "gtk_selection_fg_color"
+     :background "gtk_selection_bg_color")
     (((class color) (min-colors 88) (background light) (type ns))
      :background "ns_selection_color")
     (((class color) (min-colors 88) (background light))
--- a/lisp/font-lock.el	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/font-lock.el	Sun Aug 15 22:50:44 2010 +0000
@@ -2283,14 +2283,17 @@
 		 "inline" "lambda" "save-restriction" "save-excursion"
 		 "save-selected-window" "save-window-excursion"
 		 "save-match-data" "save-current-buffer"
-		 "unwind-protect" "condition-case" "track-mouse"
-		 "eval-after-load" "eval-and-compile" "eval-when-compile"
-		 "eval-when" "eval-next-after-load"
+		 "combine-after-change-calls" "unwind-protect"
+		 "condition-case" "condition-case-no-debug"
+		 "track-mouse" "eval-after-load" "eval-and-compile"
+		 "eval-when-compile" "eval-when" "eval-next-after-load"
 		 "with-case-table" "with-category-table"
-		 "with-current-buffer" "with-electric-help"
+		 "with-current-buffer" "with-demoted-errors"
+		 "with-electric-help"
 		 "with-local-quit" "with-no-warnings"
 		 "with-output-to-string" "with-output-to-temp-buffer"
-		 "with-selected-window" "with-selected-frame" "with-syntax-table"
+		 "with-selected-window" "with-selected-frame"
+		 "with-silent-modifications" "with-syntax-table"
 		 "with-temp-buffer" "with-temp-file" "with-temp-message"
 		 "with-timeout" "with-timeout-handler") t)
 	  "\\>")
--- a/lisp/gnus/ChangeLog	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/gnus/ChangeLog	Sun Aug 15 22:50:44 2010 +0000
@@ -1,3 +1,64 @@
+2010-08-14  Teodor Zlatanov  <tzz@lifelogs.com>
+
+	Typo fix "hoo4a" -> "hook".
+
+	* gnus-sync.el (gnus-sync-install-hooks): Typo fix.
+
+2010-08-14  Glenn Morris  <rgm@gnu.org>
+
+	* gnus-sync.el (gnus-sync): Fix defgroup version.
+
+2010-08-13  Teodor Zlatanov  <tzz@lifelogs.com>
+
+	Doc fixes and keep unknown groups (ammended for nunion bug fix).
+
+	* gnus-sync.el: Fix docs.
+	(gnus-sync-save): Keep unknown groups in `gnus-sync-newsrc-loader'.
+	(gnus-sync-read): Don't wipe `gnus-sync-newsrc-loader' after reading.
+
+2010-08-12  Teodor Zlatanov  <tzz@lifelogs.com>
+
+	Optimizations for gnus-sync.el.
+
+	* gnus-sync.el: Add docs about gnus-sync-backend
+	possibilities.
+	(gnus-sync-save): Remove unnecessary message.
+	(gnus-sync-read): Optimize and show what groups were skipped.
+
+2010-08-12  Teodor Zlatanov  <tzz@lifelogs.com>
+
+	Minor bug fixes for gnus-sync.el.
+
+	* gnus-sync.el (gnus-sync-unload-hook, gnus-sync-install-hooks): Don't
+	read the sync on get-new-news.
+
+	* gnus-sync.el (gnus-sync-save): Define `variable' so the compiler is
+	quiet.
+
+	* gnus-sync.el (gnus-sync-read): Use `gnus-sync-newsrc-offsets' (fix typo).
+
+2010-07-30  Lawrence Mitchell  <wence@gmx.li>
+
+	Make saving and restoring of hidden threads work with overlays.
+	Patch applied by Ted Zlatanov.
+
+	* gnus-sum.el (gnus-hidden-threads-configuration)
+	(gnus-restore-hidden-threads-configuration): Update to deal with text
+	properties, rather than searching for a magic character.
+
+2010-08-12  Teodor Zlatanov  <tzz@lifelogs.com>
+
+	New gnus-sync.el library for synchronization of marks.
+
+	* gnus-sync.el: New library for synchronization of marks.
+
+	* gnus-util.el (gnus-grep-in-list): Moved from gnus-registry.el and
+	renamed from `gnus-registry-grep-in-list'.
+
+	* gnus-registry.el (gnus-registry-follow-group-p): Use `gnus-grep-in-list'.
+
+	* gnus-start.el (gnus-start-draft-setup): Make it interactive.
+
 2010-08-06  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* rfc2047.el (rfc2047-encode): Use utf-8 as a last resort if
--- a/lisp/gnus/gnus-registry.el	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/gnus/gnus-registry.el	Sun Aug 15 22:50:44 2010 +0000
@@ -661,10 +661,10 @@
   "Determines if a group name should be followed.
 Consults `gnus-registry-unfollowed-groups' and
 `nnmail-split-fancy-with-parent-ignore-groups'."
-  (not (or (gnus-registry-grep-in-list
+  (not (or (gnus-grep-in-list
 	    group
 	    gnus-registry-unfollowed-groups)
-	   (gnus-registry-grep-in-list
+	   (gnus-grep-in-list
 	    group
 	    nnmail-split-fancy-with-parent-ignore-groups))))
 
@@ -745,14 +745,6 @@
 			  (assoc article (gnus-data-list nil)))))
     nil))
 
-(defun gnus-registry-grep-in-list (word list)
-"Find if a WORD matches any regular expression in the given LIST."
-  (when (and word list)
-    (catch 'found
-      (dolist (r list)
-	(when (string-match r word)
-	  (throw 'found r))))))
-
 (defun gnus-registry-do-marks (type function)
   "For each known mark, call FUNCTION for each cell of type TYPE.
 
--- a/lisp/gnus/gnus-start.el	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/gnus/gnus-start.el	Sun Aug 15 22:50:44 2010 +0000
@@ -813,6 +813,7 @@
 	  (gnus-run-hooks 'gnus-started-hook))))))
 
 (defun gnus-start-draft-setup ()
+  (interactive)
   "Make sure the draft group exists."
   (gnus-request-create-group "drafts" '(nndraft ""))
   (unless (gnus-group-entry "nndraft:drafts")
--- a/lisp/gnus/gnus-sum.el	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/gnus/gnus-sum.el	Sun Aug 15 22:50:44 2010 +0000
@@ -3406,8 +3406,10 @@
   (save-excursion
     (let (config)
       (goto-char (point-min))
-      (while (search-forward "\r" nil t)
-	(push (1- (point)) config))
+      (while (not (eobp))
+        (when (eq (get-char-property (point-at-eol) 'invisible) 'gnus-sum)
+          (push (save-excursion (forward-line 0) (point)) config))
+        (forward-line 1))
       config)))
 
 (defun gnus-restore-hidden-threads-configuration (config)
@@ -3415,10 +3417,8 @@
   (save-excursion
     (let (point (inhibit-read-only t))
       (while (setq point (pop config))
-	(when (and (< point (point-max))
-		   (goto-char point)
-		   (eq (char-after) ?\n))
-	  (subst-char-in-region point (1+ point) ?\n ?\r))))))
+        (goto-char point)
+        (gnus-summary-hide-thread)))))
 
 ;; Various summary mode internalish functions.
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/gnus/gnus-sync.el	Sun Aug 15 22:50:44 2010 +0000
@@ -0,0 +1,231 @@
+;;; gnus-sync.el --- synchronization facility for Gnus
+
+;; Copyright (C) 2010  Free Software Foundation, Inc.
+
+;; Author: Ted Zlatanov <tzz@lifelogs.com>
+;; Keywords: news synchronization nntp nnrss
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This is the gnus-sync.el package.
+
+;; Put this in your startup file (~/.gnus.el for instance)
+
+;; possibilities for gnus-sync-backend:
+;; Tramp over SSH: /ssh:user@host:/path/to/filename
+;; Tramp over IMAP: /imaps:user@yourhosthere.com:/INBOX.test/filename
+;; ...or any other file Tramp and Emacs can handle...
+
+;; (setq gnus-sync-backend "/remote:/path.gpg" ; will use Tramp+EPA if loaded
+;;       gnus-sync-global-vars `(gnus-newsrc-last-checked-date)
+;;       gnus-sync-newsrc-groups `("nntp" "nnrss")
+;;       gnus-sync-newsrc-offsets `(2 3))
+
+;; TODO:
+
+;; - after gnus-sync-read, the message counts are wrong
+
+;;; Code:
+
+(eval-when-compile (require 'cl))
+(require 'gnus-util)
+
+(defgroup gnus-sync nil
+  "The Gnus synchronization facility."
+  :version "24.1"
+  :group 'gnus)
+
+(defcustom gnus-sync-newsrc-groups `("nntp" "nnrss")
+  "List of groups to be synchronized in the gnus-newsrc-alist.
+The group names are matched, they don't have to be fully
+qualified.  Typically you would choose all of these.  That's the
+default because there is no active sync backend by default, so
+this setting is harmless until the user chooses a sync backend."
+  :group 'gnus-sync
+  :type '(repeat regexp))
+
+(defcustom gnus-sync-newsrc-offsets '(2 3)
+  "List of per-group data to be synchronized."
+  :group 'gnus-sync
+  :type '(set (const :tag "Read ranges" 2)
+              (const :tag "Marks" 3)))
+
+(defcustom gnus-sync-global-vars nil
+  "List of global variables to be synchronized.
+You may want to sync `gnus-newsrc-last-checked-date' but pretty
+much any symbol is fair game.  You could additionally sync
+`gnus-newsrc-alist', `gnus-server-alist', `gnus-topic-topology',
+and `gnus-topic-alist' to cover all the variables in
+newsrc.eld (except for `gnus-format-specs' which should not be
+synchronized, I believe).  Also see `gnus-variable-list'."
+  :group 'gnus-sync
+  :type '(repeat (choice (variable :tag "A known variable")
+                         (symbol :tag "Any symbol"))))
+
+(defcustom gnus-sync-backend nil
+  "The synchronization backend."
+  :group 'gnus-sync
+  :type '(radio (const :format "None" nil)
+                (string :tag "Sync to a file")))
+
+(defvar gnus-sync-newsrc-loader nil
+  "Carrier for newsrc data")
+
+(defun gnus-sync-save ()
+"Save the Gnus sync data to the backend."
+  (interactive)
+  (cond
+   ((stringp gnus-sync-backend)
+    (gnus-message 7 "gnus-sync: saving to backend %s" gnus-sync-backend)
+    ;; populate gnus-sync-newsrc-loader from all but the first dummy
+    ;; entry in gnus-newsrc-alist whose group matches any of the
+    ;; gnus-sync-newsrc-groups
+    ;; TODO: keep the old contents for groups we don't have!
+    (let ((gnus-sync-newsrc-loader
+           (loop for entry in (cdr gnus-newsrc-alist)
+                 when (gnus-grep-in-list
+                       (car entry)     ;the group name
+                       gnus-sync-newsrc-groups)
+                 collect (cons (car entry)
+                               (mapcar (lambda (offset)
+                                         (cons offset (nth offset entry)))
+                                       gnus-sync-newsrc-offsets)))))
+      (with-temp-file gnus-sync-backend
+        (progn
+          (let ((coding-system-for-write gnus-ding-file-coding-system)
+                (standard-output (current-buffer)))
+            (princ (format ";; -*- mode:emacs-lisp; coding: %s; -*-\n"
+                           gnus-ding-file-coding-system))
+            (princ ";; Gnus sync data v. 0.0.1\n")
+            (let* ((print-quoted t)
+                   (print-readably t)
+                   (print-escape-multibyte nil)
+                   (print-escape-nonascii t)
+                   (print-length nil)
+                   (print-level nil)
+                   (print-circle nil)
+                   (print-escape-newlines t)
+                   (variables (cons 'gnus-sync-newsrc-loader
+                                    gnus-sync-global-vars))
+                   variable)
+              (while variables
+                (if (and (boundp (setq variable (pop variables)))
+                           (symbol-value variable))
+                    (progn
+                      (princ "\n(setq ")
+                      (princ (symbol-name variable))
+                      (princ " '")
+                      (prin1 (symbol-value variable))
+                      (princ ")\n"))
+                  (princ "\n;;; skipping empty variable ")
+                  (princ (symbol-name variable)))))
+            (gnus-message
+             7
+             "gnus-sync: stored variables %s and %d groups in %s"
+             gnus-sync-global-vars
+             (length gnus-sync-newsrc-loader)
+             gnus-sync-backend)
+
+            ;; Idea from Dan Christensen <jdc@chow.mat.jhu.edu>
+            ;; Save the .eld file with extra line breaks.
+            (gnus-message 8 "gnus-sync: adding whitespace to %s"
+                          gnus-sync-backend)
+            (save-excursion
+              (goto-char (point-min))
+              (while (re-search-forward "^(\\|(\\\"" nil t)
+                (replace-match "\n\\&" t))
+              (goto-char (point-min))
+              (while (re-search-forward " $" nil t)
+                (replace-match "" t t))))))))
+    ;; the pass-through case: gnus-sync-backend is not a known choice
+    (nil)))
+
+(defun gnus-sync-read ()
+"Load the Gnus sync data from the backend."
+  (interactive)
+  (when gnus-sync-backend
+    (gnus-message 7 "gnus-sync: loading from backend %s" gnus-sync-backend)
+    (cond ((stringp gnus-sync-backend)
+           ;; read data here...
+           (if (or debug-on-error debug-on-quit)
+               (load gnus-sync-backend nil t)
+             (condition-case var
+                 (load gnus-sync-backend nil t)
+               (error
+                (error "Error in %s: %s" gnus-sync-backend (cadr var)))))
+           (let ((valid-count 0)
+                 invalid-groups)
+             (dolist (node gnus-sync-newsrc-loader)
+               (if (gnus-gethash (car node) gnus-newsrc-hashtb)
+                   (progn
+                     (incf valid-count)
+                     (loop for store in (cdr node)
+                           do (setf (nth (car store)
+                                         (assoc (car node) gnus-newsrc-alist))
+                              (cdr store))))
+                 (push (car node) invalid-groups)))
+            (gnus-message
+             7
+             "gnus-sync: loaded %d groups (out of %d) from %s"
+             valid-count (length gnus-sync-newsrc-loader)
+             gnus-sync-backend)
+            (when invalid-groups
+              (gnus-message
+               7
+               "gnus-sync: skipped %d groups (out of %d) from %s"
+               (length invalid-groups)
+               (length gnus-sync-newsrc-loader)
+               gnus-sync-backend)
+              (gnus-message 9 "gnus-sync: skipped groups: %s"
+                            (mapconcat 'identity invalid-groups ", ")))))
+          (nil))
+    ;; make the hashtable again because the newsrc-alist may have been modified
+    (when gnus-sync-newsrc-offsets
+      (gnus-message 9 "gnus-sync: remaking the newsrc hashtable")
+      (gnus-make-hashtable-from-newsrc-alist))))
+
+;;;###autoload
+(defun gnus-sync-initialize ()
+"Initialize the Gnus sync facility."
+  (interactive)
+  (gnus-message 5 "Initializing the sync facility")
+  (gnus-sync-install-hooks))
+
+;;;###autoload
+(defun gnus-sync-install-hooks ()
+  "Install the sync hooks."
+  (interactive)
+  ;; (add-hook 'gnus-get-new-news-hook 'gnus-sync-read)
+  (add-hook 'gnus-save-newsrc-hook 'gnus-sync-save)
+  (add-hook 'gnus-read-newsrc-el-hook 'gnus-sync-read))
+
+(defun gnus-sync-unload-hook ()
+  "Uninstall the sync hooks."
+  (interactive)
+  ;; (remove-hook 'gnus-get-new-news-hook 'gnus-sync-read)
+  (remove-hook 'gnus-save-newsrc-hook 'gnus-sync-save)
+  (remove-hook 'gnus-read-newsrc-el-hook 'gnus-sync-read))
+
+(add-hook 'gnus-sync-unload-hook 'gnus-sync-unload-hook)
+
+;; this is harmless by default, until the gnus-sync-backend is set
+(gnus-sync-initialize)
+
+(provide 'gnus-sync)
+
+;;; gnus-sync.el ends here
--- a/lisp/gnus/gnus-util.el	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/gnus/gnus-util.el	Sun Aug 15 22:50:44 2010 +0000
@@ -1297,6 +1297,14 @@
 	(setq alist (delq entry alist)))
       alist)))
 
+(defun gnus-grep-in-list (word list)
+  "Find if a WORD matches any regular expression in the given LIST."
+  (when (and word list)
+    (catch 'found
+      (dolist (r list)
+	(when (string-match r word)
+	  (throw 'found r))))))
+
 (defmacro gnus-pull (key alist &optional assoc-p)
   "Modify ALIST to be without KEY."
   (unless (symbolp alist)
--- a/lisp/menu-bar.el	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/menu-bar.el	Sun Aug 15 22:50:44 2010 +0000
@@ -968,6 +968,14 @@
 	      :help ,(purecopy "Turn menu-bar on/off")
 	      :button (:toggle . (> (frame-parameter nil 'menu-bar-lines) 0))))
 
+(defun menu-bar-set-tool-bar-position (position)
+  (customize-set-variable 'tool-bar-mode t)
+  (set-frame-parameter nil 'tool-bar-position position)
+  (customize-set-variable 'default-frame-alist
+			  (cons (cons 'tool-bar-position position)
+				(assq-delete-all 'tool-bar-position
+						 default-frame-alist))))
+
 (defun menu-bar-showhide-tool-bar-menu-customize-disable ()
   "Do not display tool bars."
   (interactive)
@@ -975,24 +983,20 @@
 (defun menu-bar-showhide-tool-bar-menu-customize-enable-left ()
   "Display tool bars on the left side."
   (interactive)
-  (customize-set-variable 'tool-bar-mode t)
-  (set-frame-parameter nil 'tool-bar-position 'left))
+  (menu-bar-set-tool-bar-position 'left))
 
 (defun menu-bar-showhide-tool-bar-menu-customize-enable-right ()
   "Display tool bars on the right side."
   (interactive)
-  (customize-set-variable 'tool-bar-mode t)
-  (set-frame-parameter nil 'tool-bar-position 'right))
+  (menu-bar-set-tool-bar-position 'right))
 (defun menu-bar-showhide-tool-bar-menu-customize-enable-top ()
   "Display tool bars on the top side."
   (interactive)
-  (customize-set-variable 'tool-bar-mode t)
-  (set-frame-parameter nil 'tool-bar-position 'top))
+  (menu-bar-set-tool-bar-position 'top))
 (defun menu-bar-showhide-tool-bar-menu-customize-enable-bottom ()
   "Display tool bars on the bottom side."
   (interactive)
-  (customize-set-variable 'tool-bar-mode t)
-  (set-frame-parameter nil 'tool-bar-position 'bottom))
+  (menu-bar-set-tool-bar-position 'bottom))
 
 (if (featurep 'move-toolbar)
     (progn
--- a/lisp/mouse.el	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/mouse.el	Sun Aug 15 22:50:44 2010 +0000
@@ -1265,10 +1265,17 @@
     ;; the middle of an active region.
     (deactivate-mark))
   (or mouse-yank-at-point (mouse-set-point click))
-  (let ((primary (x-get-selection 'PRIMARY)))
+  (let ((primary
+	 (cond
+	  ((fboundp 'x-get-selection-value) ; MS-DOS and MS-Windows
+	   (or (x-get-selection-value)
+	       (x-get-selection 'PRIMARY)))
+	  ;; FIXME: What about xterm-mouse-mode etc.?
+	  (t
+	   (x-get-selection 'PRIMARY)))))
     (if primary
         (insert primary)
-      (error "No primary selection"))))
+      (error "No selection is available"))))
 
 (defun mouse-kill-ring-save (click)
   "Copy the region between point and the mouse click in the kill ring.
--- a/lisp/progmodes/compile.el	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/progmodes/compile.el	Sun Aug 15 22:50:44 2010 +0000
@@ -227,6 +227,10 @@
      "^[-[:alnum:]_/ ]+: \\(?:\\(?:[sS]evere\\|[eE]rror\\|[wW]arnin\\(g\\)\\|[iI]nf\\(o\\)\\)[0-9 ]*: \\)?\
 \\([^,\" \n\t]+\\)\\(?:, line\\|:\\) \\([0-9]+\\):" 3 4 nil (1 . 2))
 
+    (ruby
+     "^[\t ]*\\(?:from \\)?\
+\\([^\(\n][^[:space:]\n]*\\):\\([1-9][0-9]*\\)\\(:in `.*'\\)?.*$" 1 2)
+
     (java
      "^\\(?:[ \t]+at \\|==[0-9]+== +\\(?:at\\|b\\(y\\)\\)\\).+(\\([^()\n]+\\):\\([0-9]+\\))$" 2 3 nil (1))
 
@@ -329,10 +333,6 @@
      "\\(?:Parse\\|Fatal\\) error: \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)"
      2 3 nil nil)
 
-    (ruby
-     "^[\t ]*\\(?:from \\)?\
-\\([^\(\n][^[:space:]\n]*\\):\\([1-9][0-9]*\\)\\(:in `.*'\\)?.*$" 1 2)
-
     (ruby-Test::Unit
      "[\t ]*\\[\\([^\(].*\\):\\([1-9][0-9]*\\)\\(\\]\\)?:$" 1 2)
 
--- a/lisp/progmodes/etags.el	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/progmodes/etags.el	Sun Aug 15 22:50:44 2010 +0000
@@ -40,6 +40,7 @@
 Use the `etags' program to make a tags table file.")
 ;; Make M-x set-variable tags-file-name like M-x visit-tags-table.
 ;;;###autoload (put 'tags-file-name 'variable-interactive (purecopy "fVisit tags table: "))
+;;;###autoload (put 'tags-file-name 'safe-local-variable 'stringp)
 
 (defgroup etags nil "Tags tables."
   :group 'tools)
--- a/lisp/progmodes/octave-mod.el	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/progmodes/octave-mod.el	Sun Aug 15 22:50:44 2010 +0000
@@ -4,7 +4,7 @@
 ;; Free Software Foundation, Inc.
 
 ;; Author: Kurt Hornik <Kurt.Hornik@wu-wien.ac.at>
-;; Author: John Eaton <jwe@bevo.che.wisc.edu>
+;; Author: John Eaton <jwe@octave.org>
 ;; Maintainer: Kurt Hornik <Kurt.Hornik@wu-wien.ac.at>
 ;; Keywords: languages
 
@@ -92,7 +92,7 @@
 (defvar octave-comment-char ?#
   "Character to start an Octave comment.")
 (defvar octave-comment-start
-  (string octave-comment-char ?\ )
+  (string octave-comment-char ?\s)
   "String to insert to start a new Octave in-line comment.")
 (defvar octave-comment-start-skip "\\s<+\\s-*"
   "Regexp to match the start of an Octave comment up to its body.")
@@ -194,15 +194,11 @@
     (define-key map ";" 'octave-electric-semi)
     (define-key map " " 'octave-electric-space)
     (define-key map "\n" 'octave-reindent-then-newline-and-indent)
-    (define-key map "\e;" 'octave-indent-for-comment)
     (define-key map "\e\n" 'octave-indent-new-comment-line)
-    (define-key map "\e\t" 'octave-complete-symbol)
     (define-key map "\M-\C-a" 'octave-beginning-of-defun)
     (define-key map "\M-\C-e" 'octave-end-of-defun)
     (define-key map "\M-\C-h" 'octave-mark-defun)
     (define-key map "\M-\C-q" 'octave-indent-defun)
-    (define-key map "\C-c;" 'octave-comment-region)
-    (define-key map "\C-c:" 'octave-uncomment-region)
     (define-key map "\C-c\C-b" 'octave-submit-bug-report)
     (define-key map "\C-c\C-p" 'octave-previous-code-line)
     (define-key map "\C-c\C-n" 'octave-next-code-line)
@@ -267,14 +263,14 @@
       ["Kill Process"		octave-kill-process t])
     "-"
     ["Indent Line"		indent-according-to-mode t]
-    ["Complete Symbol"		octave-complete-symbol t]
+    ["Complete Symbol"		completion-at-point t]
     "-"
     ["Toggle Abbrev Mode"	abbrev-mode t]
     ["Toggle Auto-Fill Mode"	auto-fill-mode t]
     "-"
     ["Submit Bug Report"	octave-submit-bug-report t]
     "-"
-    ["Describe Octave Mode"	octave-describe-major-mode t]
+    ["Describe Octave Mode"	describe-mode t]
     ["Lookup Octave Index"	octave-help t])
   "Menu for Octave mode.")
 
@@ -298,8 +294,16 @@
     (modify-syntax-entry ?\" "\"" table)
     (modify-syntax-entry ?. "w"   table)
     (modify-syntax-entry ?_ "w"   table)
-    (modify-syntax-entry ?\% "<"  table)
-    (modify-syntax-entry ?\# "<"  table)
+    ;; The "b" flag only applies to the second letter of the comstart
+    ;; and the first letter of the comend, i.e. the "4b" below is ineffective.
+    ;; If we try to put `b' on the single-line comments, we get a similar
+    ;; problem where the % and # chars appear as first chars of the 2-char
+    ;; comend, so the multi-line ender is also turned into style-b.
+    ;; So we need the new "c" comment style.
+    (modify-syntax-entry ?\% "< 13"  table)
+    (modify-syntax-entry ?\# "< 13"  table)
+    (modify-syntax-entry ?\{ "(} 2c"  table)
+    (modify-syntax-entry ?\} "){ 4c"  table)
     (modify-syntax-entry ?\n ">"  table)
     table)
   "Syntax table in use in `octave-mode' buffers.")
@@ -402,7 +406,7 @@
 
 
 ;;;###autoload
-(defun octave-mode ()
+(define-derived-mode octave-mode prog-mode "Octave"
   "Major mode for editing Octave code.
 
 This mode makes it easier to write Octave code by helping with
@@ -485,52 +489,39 @@
 This automatically sets up a mail buffer with version information
 already added.  You just need to add a description of the problem,
 including a reproducible test case and send the message."
-  (interactive)
-  (kill-all-local-variables)
+  (setq local-abbrev-table octave-abbrev-table)
 
-  (use-local-map octave-mode-map)
-  (setq major-mode 'octave-mode)
-  (setq mode-name "Octave")
-  (setq local-abbrev-table octave-abbrev-table)
-  (set-syntax-table octave-mode-syntax-table)
+  (set (make-local-variable 'indent-line-function) 'octave-indent-line)
 
-  (make-local-variable 'indent-line-function)
-  (setq indent-line-function 'octave-indent-line)
-
-  (make-local-variable 'comment-start)
-  (setq comment-start octave-comment-start)
-  (make-local-variable 'comment-end)
-  (setq comment-end "")
-  (make-local-variable 'comment-column)
-  (setq comment-column 32)
-  (make-local-variable 'comment-start-skip)
-  (setq comment-start-skip "\\s<+\\s-*")
-  (make-local-variable 'comment-indent-function)
-  (setq comment-indent-function 'octave-comment-indent)
+  (set (make-local-variable 'comment-start) octave-comment-start)
+  (set (make-local-variable 'comment-end) "")
+  ;; Don't set it here: it's not really a property of the language,
+  ;; just a personal preference of the author.
+  ;; (set (make-local-variable 'comment-column) 32)
+  (set (make-local-variable 'comment-start-skip) "\\s<+\\s-*")
+  (set (make-local-variable 'comment-add) 1)
 
-  (make-local-variable 'parse-sexp-ignore-comments)
-  (setq parse-sexp-ignore-comments t)
-  (make-local-variable 'paragraph-start)
-  (setq paragraph-start (concat "\\s-*$\\|" page-delimiter))
-  (make-local-variable 'paragraph-separate)
-  (setq paragraph-separate paragraph-start)
-  (make-local-variable 'paragraph-ignore-fill-prefix)
-  (setq paragraph-ignore-fill-prefix t)
-  (make-local-variable 'fill-paragraph-function)
-  (setq fill-paragraph-function 'octave-fill-paragraph)
-  (make-local-variable 'adaptive-fill-regexp)
-  (setq adaptive-fill-regexp nil)
-  (make-local-variable 'fill-column)
-  (setq fill-column 72)
-  (make-local-variable 'normal-auto-fill-function)
-  (setq normal-auto-fill-function 'octave-auto-fill)
+  (set (make-local-variable 'parse-sexp-ignore-comments) t)
+  (set (make-local-variable 'paragraph-start)
+       (concat "\\s-*$\\|" page-delimiter))
+  (set (make-local-variable 'paragraph-separate) paragraph-start)
+  (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
+  (set (make-local-variable 'fill-paragraph-function) 'octave-fill-paragraph)
+  ;; FIXME: Why disable it?
+  ;; (set (make-local-variable 'adaptive-fill-regexp) nil)
+  ;; Again, this is not a property of the language, don't set it here.
+  ;; (set (make-local-variable 'fill-column) 72)
+  (set (make-local-variable 'normal-auto-fill-function) 'octave-auto-fill)
 
-  (make-local-variable 'font-lock-defaults)
-  (setq font-lock-defaults '(octave-font-lock-keywords nil nil))
+  (set (make-local-variable 'font-lock-defaults)
+       '(octave-font-lock-keywords nil nil))
 
-  (make-local-variable 'imenu-generic-expression)
-  (setq imenu-generic-expression octave-mode-imenu-generic-expression
-        imenu-case-fold-search nil)
+  (set (make-local-variable 'imenu-generic-expression)
+       octave-mode-imenu-generic-expression)
+  (set (make-local-variable 'imenu-case-fold-search) nil)
+
+  (add-hook 'completion-at-point-functions
+            'octave-completion-at-point-function nil t)
 
   (octave-add-octave-menu)
   (octave-initialize-completions)
@@ -543,25 +534,22 @@
     (call-interactively 'info-lookup-symbol)))
 
 ;;; Miscellaneous useful functions
-(defun octave-describe-major-mode ()
-  "Describe the current major mode."
-  (interactive)
-  (describe-function major-mode))
 
 (defsubst octave-in-comment-p ()
   "Return t if point is inside an Octave comment."
-  (interactive)
   (save-excursion
+    ;; FIXME: use syntax-ppss?
     (nth 4 (parse-partial-sexp (line-beginning-position) (point)))))
 
 (defsubst octave-in-string-p ()
   "Return t if point is inside an Octave string."
-  (interactive)
   (save-excursion
+    ;; FIXME: use syntax-ppss?
     (nth 3 (parse-partial-sexp (line-beginning-position) (point)))))
 
 (defsubst octave-not-in-string-or-comment-p ()
   "Return t if point is not inside an Octave string or comment."
+  ;; FIXME: Use syntax-ppss?
   (let ((pps (parse-partial-sexp (line-beginning-position) (point))))
     (not (or (nth 3 pps) (nth 4 pps)))))
 
@@ -620,23 +608,9 @@
     (delete-horizontal-space)
     (insert (concat " " octave-continuation-string))))
 
-;;; Comments
-(defun octave-comment-region (beg end &optional arg)
-  "Comment or uncomment each line in the region as Octave code.
-See `comment-region'."
-  (interactive "r\nP")
-  (let ((comment-start (char-to-string octave-comment-char)))
-    (comment-region beg end arg)))
-
-(defun octave-uncomment-region (beg end &optional arg)
-  "Uncomment each line in the region as Octave code."
-  (interactive "r\nP")
-  (or arg (setq arg 1))
-  (octave-comment-region beg end (- arg)))
-
 
 ;;; Indentation
-(defun calculate-octave-indent ()
+(defun octave-indent-calculate ()
   "Return appropriate indentation for current line as Octave code.
 Returns an integer (the column to indent to) unless the line is a
 comment line with fixed goal golumn.  In that case, returns a list whose
@@ -722,36 +696,13 @@
     (beginning-of-line)
     (and (bobp) (looking-at "\\s-*#!"))))
 
-(defun octave-comment-indent ()
-  (if (or (looking-at "\\s<\\s<\\s<")
-	  (octave-before-magic-comment-p))
-      0
-    (if (looking-at "\\s<\\s<")
-	(calculate-octave-indent)
-      (skip-syntax-backward " ")
-      (max (if (bolp) 0 (+ 1 (current-column)))
-	   comment-column))))
-
-(defun octave-indent-for-comment ()
-  "Maybe insert and indent an Octave comment.
-If there is no comment already on this line, create a code-level comment
-\(started by two comment characters) if the line is empty, or an in-line
-comment (started by one comment character) otherwise.
-Point is left after the start of the comment which is properly aligned."
-  (interactive)
-  (beginning-of-line)
-  (if (looking-at "^\\s-*$")
-      (insert octave-block-comment-start)
-    (indent-for-comment))
-  (indent-according-to-mode))
-
 (defun octave-indent-line (&optional arg)
   "Indent current line as Octave code.
 With optional ARG, use this as offset unless this line is a comment with
 fixed goal column."
   (interactive)
   (or arg (setq arg 0))
-  (let ((icol (calculate-octave-indent))
+  (let ((icol (octave-indent-calculate))
 	(relpos (- (current-column) (current-indentation))))
     (if (listp icol)
 	(setq icol (car icol))
@@ -1166,7 +1117,7 @@
 		(beginning-of-line)
 		(point)))
 	 (cfc (current-fill-column))
-	 (ind (calculate-octave-indent))
+	 (ind (octave-indent-calculate))
 	 comment-prefix)
      (save-restriction
        (goto-char beg)
@@ -1237,20 +1188,24 @@
   (if octave-completion-alist
       ()
     (setq octave-completion-alist
-	  (mapcar '(lambda (var) (cons var var))
-		  (append octave-reserved-words
-			  octave-text-functions
-			  octave-variables)))))
+          (append octave-reserved-words
+                  octave-text-functions
+                  octave-variables))))
+
+(defun octave-completion-at-point-function ()
+  "Find the text to complete and the corresponding table."
+  (let* ((beg (save-excursion (backward-sexp 1) (point)))
+         (end (if (< beg (point))
+                  (save-excursion (goto-char beg) (forward-sexp 1) (point))
+                (point))))
+    (list beg end octave-completion-alist)))
 
 (defun octave-complete-symbol ()
   "Perform completion on Octave symbol preceding point.
 Compare that symbol against Octave's reserved words and builtin
 variables."
   (interactive)
-  (let* ((end (point))
-	 (beg (save-excursion (backward-sexp 1) (point))))
-    (completion-in-region beg end octave-completion-alist)))
-
+  (apply 'completion-in-region (octave-completion-at-point-function)))
 
 ;;; Electric characters && friends
 (defun octave-reindent-then-newline-and-indent ()
@@ -1324,42 +1279,27 @@
 	    (list-abbrevs))
 	(setq unread-command-events (list c))))))
 
-(defun octave-insert-defun (name args vals)
+(define-skeleton octave-insert-defun
   "Insert an Octave function skeleton.
 Prompt for the function's name, arguments and return values (to be
 entered without parens)."
-  (interactive
-   (list
-    (read-from-minibuffer "Function name: "
-			  (substring (buffer-name) 0 -2))
-    (read-from-minibuffer "Arguments: ")
-    (read-from-minibuffer "Return values: ")))
-  (let ((string (format "%s %s (%s)"
-			(cond
-			 ((string-equal vals "")
-			  vals)
-			 ((string-match "[ ,]" vals)
-			  (concat " [" vals "] ="))
-			 (t
-			  (concat " " vals " =")))
-			name
-			args))
-	(prefix octave-block-comment-start))
-    (if (not (bobp)) (newline))
-    (insert "function" string)
-    (indent-according-to-mode)
-    (newline 2)
-    (insert prefix "usage: " string)
-    (reindent-then-newline-and-indent)
-    (insert prefix)
-    (reindent-then-newline-and-indent)
-    (insert prefix)
-    (indent-according-to-mode)
-    (save-excursion
-      (newline 2)
-      (insert "endfunction")
-      (indent-according-to-mode))))
-
+  (let* ((defname (substring (buffer-name) 0 -2))
+         (name (read-string (format "Function name (default %s): " defname)
+                            nil nil defname))
+         (args (read-string "Arguments: "))
+         (vals (read-string "Return values: ")))
+    (format "%s%s (%s)"
+            (cond
+             ((string-equal vals "") vals)
+             ((string-match "[ ,]" vals) (concat "[" vals "] = "))
+             (t (concat vals " = ")))
+            name
+            args))
+  \n "function " > str \n \n
+  octave-block-comment-start "usage: " str \n
+  octave-block-comment-start \n octave-block-comment-start
+  \n _ \n
+  "endfunction" > \n)
 
 ;;; Menu
 (defun octave-add-octave-menu ()
--- a/lisp/progmodes/scheme.el	Wed Aug 11 03:20:07 2010 +0000
+++ b/lisp/progmodes/scheme.el	Sun Aug 15 22:50:44 2010 +0000
@@ -107,7 +107,7 @@
     ;; Special characters
     (modify-syntax-entry ?, "'   " st)
     (modify-syntax-entry ?@ "'   " st)
-    (modify-syntax-entry ?# "' 14b" st)
+    (modify-syntax-entry ?# "' 14" st)
     (modify-syntax-entry ?\\ "\\   " st)
     st))
 
--- a/nt/ChangeLog	Wed Aug 11 03:20:07 2010 +0000
+++ b/nt/ChangeLog	Sun Aug 15 22:50:44 2010 +0000
@@ -1,3 +1,7 @@
+2010-08-12  Jason Rumney  <jasonr@gnu.org>
+
+	* addpm.c (add_registry): Set path for runemacs.exe to use.
+
 2010-08-08  Óscar Fuentes  <ofv@wanadoo.es>
 
 	* cmdproxy.c (main): Use _snprintf instead of wsprintf,
--- a/nt/addpm.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/nt/addpm.c	Sun Aug 15 22:50:44 2010 +0000
@@ -62,6 +62,8 @@
 #define REG_GTK "SOFTWARE\\GTK\\2.0"
 #define REG_APP_PATH \
   "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\emacs.exe"
+#define REG_RUNEMACS_PATH \
+  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\runemacs.exe"
 
 static struct entry
 {
@@ -129,10 +131,25 @@
                   /* Make sure the emacs bin directory continues to be searched
                      first by including it as well.  */
                   char *dll_paths;
+		  HKEY runemacs_key = NULL;
                   len = strlen (path) + 5 + size;
                   dll_paths = (char *) alloca (size + strlen (path) + 1);
                   sprintf (dll_paths, "%s\\bin;%s", path, gtk_path);
                   RegSetValueEx (hrootkey, "Path", 0, REG_SZ, dll_paths, len);
+
+		  /* Set the same path for runemacs.exe, as the Explorer shell
+		     looks this up, so the above does not take effect when
+		     emacs.exe is spawned from runemacs.exe.  */
+		  if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, REG_RUNEMACS_PATH,
+				      0, "", REG_OPTION_NON_VOLATILE,
+				      KEY_WRITE, NULL, &runemacs_key, NULL)
+		      == ERROR_SUCCESS)
+		    {
+		      RegSetValueEx (runemacs_key, "Path", 0, REG_SZ,
+				     dll_paths, len);
+
+		      RegCloseKey (runemacs_key);
+		    }
                 }
             }
           RegCloseKey (gtk_key);
--- a/src/ChangeLog	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/ChangeLog	Sun Aug 15 22:50:44 2010 +0000
@@ -1,9 +1,201 @@
+2010-08-15  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* keyboard.c (parse_tool_bar_item): Put in a bad label if :label
+	isn't a string.
+
+2010-08-15  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* keyboard.c (parse_tool_bar_item): Avoid excessive use of strlen.
+
+2010-08-15  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* keyboard.c (parse_tool_bar_item): malloc buf.  Set TOOL_BAR_ITEM_LABEL
+	to empty string if not set to new_lbl (Bug#6855).
+
+2010-08-14  Eli Zaretskii  <eliz@gnu.org>
+
+	* xterm.c (x_draw_stretch_glyph_string):
+	* w32term.c (x_draw_stretch_glyph_string): In R2L rows, display
+	the cursor on the right edge of the stretch glyph.
+
+	* xdisp.c (window_box_right_offset, window_box_right): Fix
+	commentary.
+
+	* xdisp.c (Fcurrent_bidi_paragraph_direction): Fix paragraph
+	direction when point is inside a run of whitespace characters.
+
+	* bidi.c (bidi_at_paragraph_end): Remove obsolete comment.
+
+2010-08-14  Jason Rumney  <jasonr@gnu.org>
+
+	* keyboard.c (lispy_function_keys): Do not define VK_PACKET (bug#4836)
+
+2010-08-14  Chong Yidong  <cyd@stupidchicken.com>
+
+	* fns.c (Fmake_hash_table): Doc fix (Bug#6851).
+
+2010-08-13  Jason Rumney  <jasonr@gnu.org>
+
+	* w32menu.c (simple_dialog_show): Use unicode message box if available.
+	(MessageBoxW_Proc): New function typedef.
+	(unicode-message-box): New function pointer.
+	(globals_of_w32menu): Import it from user32.dll. (Bug#5629)
+
+2010-08-13  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* frame.h (Qtool_bar_position): Declare.
+
+	* xfns.c (Fx_create_frame): Call x_default_parameter for
+	Qtool_bar_position.
+
+2010-08-13  Eli Zaretskii  <eliz@gnu.org>
+
+	* unexcoff.c: Remove the parts used when "emacs" is not defined.
+	(report_error, report_error_1): Ditto.
+	(write_segment): Remove "#if 0" unused code.
+	(make_hdr): Remove code that was "#ifndef NO_REMAP" before
+	NO_REMAP was removed (in revno 100928).
+	(start_of_text): Remove unused function (was used only if NO_REMAP
+	was NOT defined).
+
+	* msdos.c (IT_set_face): Fix format string to match argument
+	types.
+	(IT_write_glyphs, IT_note_mode_line_highlight)
+	(IT_set_frame_parameters): Remove unused variables.
+	(x_set_menu_bar_lines): Declare set_menu_bar_lines.
+	(IT_set_terminal_modes): Disambiguate expression in if clause.
+	(Fmsdos_remember_default_colors): Return Qnil.
+	(IT_set_frame_parameters): Add parens to disambiguate boolean
+	expression for logging the cursor type to termscript.
+	(keyboard_layout_list, keypad_translate_map)
+	(grey_key_translate_map): Add braces in inner initializers.
+	(dos_rawgetc): Add parens in condition for mouse-3 button-press.
+	(dos_rawgetc): Remove unused label.
+	(XMenuActivate): Add braces to remove ambiguous `else'.
+	(dos_ttraw): Always return a value.
+	(spawnve): Declare.
+	(run_msdos_command): Cast 3rd arg of spawnve to "char **".
+
+	* dosfns.h (x_set_title): Declare.
+
+	* w16select.c (Fw16_set_clipboard_data, Fw16_get_clipboard_data):
+	Remove unused variables.
+
+	* dosfns.c (Fint86, Fdos_memget, Fdos_memput): Remove unused
+	variables.
+	(init_dosfns): Declare get_lim_data.
+	(system_process_attributes): Declare Fget_internal_run_time.
+
+	* xmenu.c (xmenu_show) [!USE_X_TOOLKIT && !USE_GTK]: Fix argument
+	list to be consistent with menu.h.
+
+	* w32menu.c (add_menu_item, name_is_separator): Shut up compiler
+	warnings due to mixing of "char *" and "const char *".
+
+2010-08-12  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	Introduce a new comment style "c" flag.
+	* syntax.c (SYNTAX_FLAGS_COMMENT_STYLEB)
+	(SYNTAX_FLAGS_COMMENT_STYLEC): New macros.
+	(SYNTAX_FLAGS_COMMENT_STYLE): Use them, add an argument.
+	(syntax_prefix_flag_p): New function.
+	(Fstring_to_syntax): Understand new "c" flag.
+	(Finternal_describe_syntax_value): Recognize new flag; use the
+	SYNTAX_FLAGS_* macros.
+	(scan_sexps_forward, Fparse_partial_sexp): Change representation of
+	comment style to accomodate the new styles.
+	(back_comment, forw_comment, Fforward_comment, scan_lists)
+	(scan_sexps_forward): Update code to obey the new comment style flag.
+
+	* syntax.h: Move SYNTAX_FLAGS_FOO() macros to syntax.c.
+
+	* casefiddle.c (casify_region): Use the new syntax_prefix_flag_p.
+
+2010-08-11  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xfns.c (x_defined_color): If USE_GTK, call xg_check_special_colors
+	first.
+	(Fx_hide_tip): Check FRAME_LIVE_P (f) before calling xg_hide_tooltip.
+
+	* gtkutil.h (xg_check_special_colors): Declare.
+
+	* gtkutil.c (xg_check_special_colors, style_changed_cb): New functions.
+	(xg_create_frame_widgets): Connect theme name changes to
+	style_changed_cb.
+
+	* xterm.c (emacs_class): New char[] for EMACS_CLASS.
+	(xim_open_dpy, xim_initialize, xim_close_dpy): Use emacs_class.
+	(x_term_init): Use char[] display_opt and name_opt instead of
+	string literal. file is const char*.
+
+	* xsmfns.c (NOSPLASH_OPT): Change to char[].
+	(smc_save_yourself_CB): Do xstrdup on all ->type and ->name for
+	props.  Free them at the end.
+
+	* xselect.c (Fx_get_atom_name): Use char empty[] instead of literal "".
+
+	* xrdb.c (get_system_app): Make path const and use char *p for
+	non-const char.
+
+	* xmenu.c (Fx_popup_dialog): error_name is const char*.
+	(xmenu_show): error parameter is const char **. pane_string is const
+	char *.
+	(button_names): Is const char *.
+	(xdialog_show): error_name and pane_string is const.
+
+	* process.h (synch_process_death): Is const char*.
+
+	* w32menu.c (w32_menu_show):
+	* nsmenu.m (ns_menu_show): error parameter is const char **.
+
+	* menu.h (w32_menu_show, ns_menu_show, xmenu_show): error parameter
+	is const char **.
+
+	* menu.c (Fx_popup_menu): error_name is const.
+
+	* keyboard.h (_widget_value): Add defined USE_GTK.  Replace Boolean
+	with unsigned char and XtPointer with void *.
+
+	* gtkutil.h: Replace widget_value with struct _widget_value.
+	(enum button_type, struct _widget_value): Remove and use the one from
+	keyboard.h.
+
+	* gtkutil.c (get_utf8_string): Always return an allocated string.
+	Parameter is const.
+	(create_dialog, xg_create_one_menuitem, create_menus)
+	(xg_item_label_same_p, xg_update_menu_item): Free result from
+	get_utf8_string.
+	(xg_separator_p, xg_item_label_same_p): label is const.
+
+	* font.h (font_open_by_name): Make name const.
+
+	* font.c (font_open_by_name): Make name const.
+
+	* floatfns.c (matherr): Use a const char* variable for x->name.
+
+	* emacs.c (main): Pass char[] to putenv instead of literal.
+
+	* callproc.c (synch_process_death): Make const.
+	(Fcall_process): Make signame const.
+
+	* nsterm.h (parseKeyEquiv, addSubmenuWithTitle)
+	(addDisplayItemWithImage): Use const char*.
+
+	* nsmenu.m (parseKeyEquiv, addSubmenuWithTitle)
+	(addDisplayItemWithImage, update_frame_tool_bar): Use const char*.
+
+	* nsfont.m (ns_descriptor_to_entity): Use const char*.
+
+	* keyboard.h (_widget_value): name, value and key are const char*.
+
+	* unexmacosx.c (unexec_error): Use const char *.
+
 2010-08-09  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* font.h (font_parse_xlfd, font_parse_fcname, font_unparse_fcname)
-	(font_parse_name): font_open_by_name):
+	(font_parse_name, font_open_by_name):
 	* font.c (font_parse_xlfd, font_parse_fcname, font_unparse_fcname)
-	(font_parse_name): font_open_by_name): Remove const.
+	(font_parse_name, font_open_by_name): Remove const.
 
 2010-08-09  Andreas Schwab  <schwab@linux-m68k.org>
 
@@ -126,17 +318,17 @@
 
 	* s/freebsd.h (DECLARE_GETPWUID_WITH_UID_T): Remove, unused.
 
-	* xrdb.c: Remove include guard.  Remove
-	DECLARE_GETPWUID_WITH_UID_T conditional it had no effect.
+	* xrdb.c: Remove include guard.
+	Remove DECLARE_GETPWUID_WITH_UID_T conditional it had no effect.
 	Remove #if 0 code.  Replace malloc->xmalloc, free->xfree,
 	realloc->xrealloc instead of using #defines.
 
 2010-08-08  Eli Zaretskii  <eliz@gnu.org>
 
 	* cmds.c (Fforward_line, Fbeginning_of_line, Fend_of_line):
-	* editfns.c (Fline_beginning_position, Fline_end_position): State
-	in the doc strings that start and end of line are in the logical
-	order.
+	* editfns.c (Fline_beginning_position, Fline_end_position):
+	State in the doc strings that start and end of line are in the
+	logical order.
 
 	* xdisp.c (display_line): Move the handling of overlay arrow after
 	the call to find_row_edges.  (Bug#6699)
--- a/src/bidi.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/bidi.c	Sun Aug 15 22:50:44 2010 +0000
@@ -497,7 +497,6 @@
 static EMACS_INT
 bidi_at_paragraph_end (EMACS_INT charpos, EMACS_INT bytepos)
 {
-  /* FIXME: Why Fbuffer_local_value rather than just Fsymbol_value?  */
   Lisp_Object sep_re;
   Lisp_Object start_re;
   EMACS_INT val;
--- a/src/callproc.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/callproc.c	Sun Aug 15 22:50:44 2010 +0000
@@ -115,7 +115,7 @@
 int synch_process_alive;
 
 /* Nonzero => this is a string explaining death of synchronous subprocess.  */
-char *synch_process_death;
+const char *synch_process_death;
 
 /* Nonzero => this is the signal number that terminated the subprocess.  */
 int synch_process_termsig;
@@ -818,7 +818,7 @@
 
   if (synch_process_termsig)
     {
-      char *signame;
+      const char *signame;
 
       synchronize_system_messages_locale ();
       signame = strsignal (synch_process_termsig);
--- a/src/casefiddle.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/casefiddle.c	Sun Aug 15 22:50:44 2010 +0000
@@ -243,7 +243,8 @@
 	       && (!inword || flag != CASE_CAPITALIZE_UP))
 	c = UPCASE1 (c);
       if ((int) flag >= (int) CASE_CAPITALIZE)
-	inword = ((SYNTAX (c) == Sword) && (inword || !SYNTAX_PREFIX (c)));
+	inword = ((SYNTAX (c) == Sword)
+		  && (inword || !syntax_prefix_flag_p (c)));
       if (c != c2)
 	{
 	  last = start;
--- a/src/dosfns.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/dosfns.c	Sun Aug 15 22:50:44 2010 +0000
@@ -60,7 +60,6 @@
   register int i;
   int no;
   union REGS inregs, outregs;
-  Lisp_Object val;
 
   CHECK_NUMBER (interrupt);
   no = (unsigned long) XINT (interrupt);
@@ -101,7 +100,6 @@
   register int i;
   int offs, len;
   char *buf;
-  Lisp_Object val;
 
   CHECK_NUMBER (address);
   offs = (unsigned long) XINT (address);
@@ -125,7 +123,6 @@
   register int i;
   int offs, len;
   char *buf;
-  Lisp_Object val;
 
   CHECK_NUMBER (address);
   offs = (unsigned long) XINT (address);
@@ -286,6 +283,8 @@
   unsigned long xbuf = _go32_info_block.linear_address_of_transfer_buffer;
 
 #ifndef SYSTEM_MALLOC
+  extern void get_lim_data (void);
+
   get_lim_data (); /* why the hell isn't this called elsewhere? */
 #endif
 
@@ -558,6 +557,7 @@
       int i;
       Lisp_Object cmd_str, decoded_cmd, tem;
       double pmem;
+      EXFUN (Fget_internal_run_time, 0);
 #ifndef SYSTEM_MALLOC
       extern unsigned long ret_lim_data ();
 #endif
--- a/src/dosfns.h	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/dosfns.h	Sun Aug 15 22:50:44 2010 +0000
@@ -40,6 +40,7 @@
 
 extern int         msdos_stdcolor_idx  (const char *);
 extern Lisp_Object msdos_stdcolor_name (int);
+extern void        x_set_title (struct frame *, Lisp_Object);
 #endif
 
 /* arch-tag: a83b8c4c-63c8-451e-9e94-bc72e3e2f8bc
--- a/src/emacs.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/emacs.c	Sun Aug 15 22:50:44 2010 +0000
@@ -839,8 +839,9 @@
           || strcmp (argv[argc-1], "bootstrap") == 0)
       && ! getenv ("EMACS_HEAP_EXEC"))
     {
+      static char heapexec[] = "EMACS_HEAP_EXEC=true";
       /* Set this so we only do this once.  */
-      putenv("EMACS_HEAP_EXEC=true");
+      putenv(heapexec);
 
       /* A flag to turn off address randomization which is introduced
          in linux kernel shipped with fedora core 4 */
--- a/src/floatfns.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/floatfns.c	Sun Aug 15 22:50:44 2010 +0000
@@ -987,16 +987,18 @@
 matherr (struct exception *x)
 {
   Lisp_Object args;
+  const char *name = x->name;
+
   if (! in_float)
     /* Not called from emacs-lisp float routines; do the default thing. */
     return 0;
   if (!strcmp (x->name, "pow"))
-    x->name = "expt";
+    name = "expt";
 
   args
-    = Fcons (build_string (x->name),
+    = Fcons (build_string (name),
 	     Fcons (make_float (x->arg1),
-		    ((!strcmp (x->name, "log") || !strcmp (x->name, "pow"))
+		    ((!strcmp (name, "log") || !strcmp (name, "pow"))
 		     ? Fcons (make_float (x->arg2), Qnil)
 		     : Qnil)));
   switch (x->type)
--- a/src/fns.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/fns.c	Sun Aug 15 22:50:44 2010 +0000
@@ -4419,13 +4419,13 @@
 Default is 65.
 
 :rehash-size REHASH-SIZE - Indicates how to expand the table when it
-fills up.  If REHASH-SIZE is an integer, add that many space.  If it
-is a float, it must be > 1.0, and the new size is computed by
-multiplying the old size with that factor.  Default is 1.5.
+fills up.  If REHASH-SIZE is an integer, increase the size by that
+amount.  If it is a float, it must be > 1.0, and the new size is the
+old size multiplied by that factor.  Default is 1.5.
 
 :rehash-threshold THRESHOLD -- THRESHOLD must a float > 0, and <= 1.0.
 Resize the hash table when the ratio (number of entries / table size)
-is greater or equal than THRESHOLD.  Default is 0.8.
+is greater than or equal to THRESHOLD.  Default is 0.8.
 
 :weakness WEAK -- WEAK must be one of nil, t, `key', `value',
 `key-or-value', or `key-and-value'.  If WEAK is not nil, the table
--- a/src/font.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/font.c	Sun Aug 15 22:50:44 2010 +0000
@@ -3506,7 +3506,7 @@
    found, return Qnil.  */
 
 Lisp_Object
-font_open_by_name (FRAME_PTR f, char *name)
+font_open_by_name (FRAME_PTR f, const char *name)
 {
   Lisp_Object args[2];
   Lisp_Object spec, ret;
--- a/src/font.h	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/font.h	Sun Aug 15 22:50:44 2010 +0000
@@ -783,7 +783,7 @@
 extern void font_done_for_face (FRAME_PTR f, struct face *face);
 
 extern Lisp_Object font_open_by_spec (FRAME_PTR f, Lisp_Object spec);
-extern Lisp_Object font_open_by_name (FRAME_PTR f, char *name);
+extern Lisp_Object font_open_by_name (FRAME_PTR f, const char *name);
 extern void font_close_object (FRAME_PTR f, Lisp_Object font_object);
 
 extern Lisp_Object font_intern_prop (const char *str, int len, int force_symbol);
--- a/src/frame.h	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/frame.h	Sun Aug 15 22:50:44 2010 +0000
@@ -1050,7 +1050,7 @@
 extern Lisp_Object Qicon, Qicon_name, Qicon_type, Qicon_left, Qicon_top;
 extern Lisp_Object Qinternal_border_width;
 extern Lisp_Object Qtooltip;
-extern Lisp_Object Qmenu_bar_lines, Qtool_bar_lines;
+extern Lisp_Object Qmenu_bar_lines, Qtool_bar_lines, Qtool_bar_position;
 extern Lisp_Object Qmouse_color;
 extern Lisp_Object Qname, Qtitle;
 extern Lisp_Object Qparent_id;
--- a/src/gtkutil.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/gtkutil.c	Sun Aug 15 22:50:44 2010 +0000
@@ -432,20 +432,22 @@
 }
 
 /* Allocate and return a utf8 version of STR.  If STR is already
-   utf8 or NULL, just return STR.
-   If not, a new string is allocated and the caller must free the result
+   utf8 or NULL, just return a copy of STR.
+   A new string is allocated and the caller must free the result
    with g_free.  */
 
 static char *
-get_utf8_string (char *str)
+get_utf8_string (const char *str)
 {
-  char *utf8_str = str;
+  char *utf8_str;
 
   if (!str) return NULL;
 
   /* If not UTF-8, try current locale.  */
   if (!g_utf8_validate (str, -1, NULL))
     utf8_str = g_locale_to_utf8 (str, -1, 0, 0, 0);
+  else
+    return g_strdup (str);
 
   if (!utf8_str)
     {
@@ -504,6 +506,41 @@
   return utf8_str;
 }
 
+/* Check for special colors used in face spec for region face.
+   The colors are fetched from the Gtk+ theme.
+   Return 1 if color was found, 0 if not.  */
+
+int
+xg_check_special_colors (struct frame *f,
+                         const char *color_name,
+                         XColor *color)
+{
+  int success_p = 0;
+  if (FRAME_GTK_WIDGET (f))
+    {
+      if (strcmp ("gtk_selection_bg_color", color_name) == 0)
+        {
+          GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f));
+          color->red = gsty->bg[GTK_STATE_SELECTED].red;
+          color->green = gsty->bg[GTK_STATE_SELECTED].green;
+          color->blue = gsty->bg[GTK_STATE_SELECTED].blue;
+          color->pixel = gsty->bg[GTK_STATE_SELECTED].pixel;
+          success_p = 1;
+        }
+      else if (strcmp ("gtk_selection_fg_color", color_name) == 0)
+        {
+          GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f));
+          color->red = gsty->fg[GTK_STATE_SELECTED].red;
+          color->green = gsty->fg[GTK_STATE_SELECTED].green;
+          color->blue = gsty->fg[GTK_STATE_SELECTED].blue;
+          color->pixel = gsty->fg[GTK_STATE_SELECTED].pixel;
+          success_p = 1;
+        }
+    }
+
+  return success_p;
+}
+
 
 
 /***********************************************************************
@@ -896,6 +933,26 @@
   gdk_colormap_query_color (map, pixel, c);
 }
 
+/* Callback called when the gtk theme changes.
+   We notify lisp code so it can fix faces used for region for example.  */
+
+static void
+style_changed_cb (GObject *go,
+                  GParamSpec *spec,
+                  gpointer user_data)
+{
+  struct input_event event;
+  GdkDisplay *gdpy = (GdkDisplay *) user_data;
+  const char *display_name = gdk_display_get_name (gdpy);
+
+  EVENT_INIT (event);
+  event.kind = CONFIG_CHANGED_EVENT;
+  event.frame_or_window = make_string (display_name, strlen (display_name));
+  /* Theme doesn't change often, so intern is called seldom.  */
+  event.arg = intern ("theme-name");
+  kbd_buffer_store_event (&event);
+}
+
 /* Create and set up the GTK widgets for frame F.
    Return 0 if creation failed, non-zero otherwise.  */
 
@@ -1021,6 +1078,22 @@
   g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f);
 #endif
 
+  {
+    GdkScreen *screen = gtk_widget_get_screen (wtop);
+    GtkSettings *gs = gtk_settings_get_for_screen (screen);
+    /* Only connect this signal once per screen.  */
+    if (! g_signal_handler_find (G_OBJECT (gs),
+                                 G_SIGNAL_MATCH_FUNC,
+                                 0, 0, 0,
+                                 G_CALLBACK (style_changed_cb),
+                                 0))
+      {
+        g_signal_connect (G_OBJECT (gs), "notify::gtk-theme-name",
+                          G_CALLBACK (style_changed_cb),
+                          gdk_screen_get_display (screen));
+      }
+  }
+
   UNBLOCK_INPUT;
 
   return 1;
@@ -1336,7 +1409,7 @@
             }
         }
 
-     if (utf8_label && utf8_label != item->value)
+     if (utf8_label)
        g_free (utf8_label);
     }
 
@@ -2076,7 +2149,7 @@
 };
 
 static int
-xg_separator_p (char *label)
+xg_separator_p (const char *label)
 {
   if (! label) return 0;
   else if (strlen (label) > 3
@@ -2174,8 +2247,8 @@
 
   w = make_menu_item (utf8_label, utf8_key, item, group);
 
-  if (utf8_label && utf8_label != item->name) g_free (utf8_label);
-  if (utf8_key && utf8_key != item->key) g_free (utf8_key);
+  if (utf8_label) g_free (utf8_label);
+  if (utf8_key) g_free (utf8_key);
 
   cb_data = xmalloc (sizeof (xg_menu_item_cb_data));
 
@@ -2311,7 +2384,7 @@
           gtk_menu_set_title (GTK_MENU (wmenu), utf8_label);
           w = gtk_menu_item_new_with_label (utf8_label);
           gtk_widget_set_sensitive (w, FALSE);
-          if (utf8_label && utf8_label != item->name) g_free (utf8_label);
+          if (utf8_label) g_free (utf8_label);
         }
       else if (xg_separator_p (item->name))
         {
@@ -2432,7 +2505,7 @@
 /* Return non-zero if the menu item WITEM has the text LABEL.  */
 
 static int
-xg_item_label_same_p (GtkMenuItem *witem, char *label)
+xg_item_label_same_p (GtkMenuItem *witem, const char *label)
 {
   int is_same = 0;
   char *utf8_label = get_utf8_string (label);
@@ -2443,7 +2516,7 @@
   else if (old_label && utf8_label)
     is_same = strcmp (utf8_label, old_label) == 0;
 
-  if (utf8_label && utf8_label != label) g_free (utf8_label);
+  if (utf8_label) g_free (utf8_label);
 
   return is_same;
 }
@@ -2590,6 +2663,7 @@
             /* Set the title of the detached window.  */
             gtk_menu_set_title (GTK_MENU (submenu), utf8_label);
 
+          if (utf8_label) g_free (utf8_label);
           iter = g_list_next (iter);
           val = val->next;
           ++pos;
@@ -2729,8 +2803,8 @@
   if (! old_label || strcmp (utf8_label, old_label) != 0)
     gtk_label_set_text (wlbl, utf8_label);
 
-  if (utf8_key && utf8_key != val->key) g_free (utf8_key);
-  if (utf8_label && utf8_label != val->name) g_free (utf8_label);
+  if (utf8_key) g_free (utf8_key);
+  if (utf8_label) g_free (utf8_label);
 
   if (! val->enabled && gtk_widget_get_sensitive (w))
     gtk_widget_set_sensitive (w, FALSE);
--- a/src/gtkutil.h	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/gtkutil.h	Sun Aug 15 22:50:44 2010 +0000
@@ -38,14 +38,6 @@
 /* Key for data that menu items hold.  */
 #define XG_ITEM_DATA "emacs_menuitem"
 
-/* Button types in menus.  */
-enum button_type
-{
-  BUTTON_TYPE_NONE,
-  BUTTON_TYPE_TOGGLE,
-  BUTTON_TYPE_RADIO
-};
-
 /* This is a list node in a generic list implementation.  */
 typedef struct xg_list_node_
 {
@@ -82,48 +74,13 @@
 } xg_menu_item_cb_data;
 
 
-/* Used to specify menus and dialogs.
-   This is an adaption from lwlib for Gtk so we can use more of the same
-   code as lwlib in xmenu.c.  */
-typedef struct _widget_value
-{
-  /* name of widget */
-  Lisp_Object   lname;
-  char		*name;
-  /* value (meaning depend on widget type) */
-  char		*value;
-  /* keyboard equivalent. no implications for XtTranslations */
-  Lisp_Object   lkey;
-  char		*key;
-  /* Help string or nil if none.
-     GC finds this string through the frame's menu_bar_vector
-     or through menu_items.  */
-  Lisp_Object	help;
-  /* true if enabled */
-  gint	        enabled;
-  /* true if selected */
-  gint	selected;
-  /* The type of a button.  */
-  enum button_type button_type;
-  /* Contents of the sub-widgets, also selected slot for checkbox */
-  struct _widget_value	*contents;
-  /* data passed to callback */
-  gpointer	call_data;
-  /* next one in the list */
-  struct _widget_value	*next;
-
-  /* we resource the widget_value structures; this points to the next
-     one on the free list if this one has been deallocated.
-   */
-  struct _widget_value *free_list;
-} widget_value;
-
 #ifdef HAVE_GTK_FILE_SELECTION_NEW
 extern int use_old_gtk_file_dialog;
 #endif
+struct _widget_value;
 
-extern widget_value *malloc_widget_value (void);
-extern void free_widget_value (widget_value *);
+extern struct _widget_value *malloc_widget_value (void);
+extern void free_widget_value (struct _widget_value *);
 
 extern int xg_uses_old_file_dialog (void);
 
@@ -138,14 +95,14 @@
 extern GtkWidget *xg_create_widget (const char *type,
                                     const char *name,
                                     FRAME_PTR f,
-                                    widget_value *val,
+                                    struct _widget_value *val,
                                     GCallback select_cb,
                                     GCallback deactivate_cb,
                                     GCallback hightlight_cb);
 
 extern void xg_modify_menubar_widgets (GtkWidget *menubar,
                                        FRAME_PTR f,
-                                       widget_value *val,
+                                       struct _widget_value *val,
                                        int deep_p,
                                        GCallback select_cb,
                                        GCallback deactivate_cb,
@@ -199,6 +156,9 @@
                                 long flags,
                                 int user_position);
 extern void xg_set_background_color (FRAME_PTR f, unsigned long bg);
+extern int xg_check_special_colors (struct frame *f,
+                                    const char *color_name,
+                                    XColor *color);
 
 extern void xg_set_frame_icon (FRAME_PTR f,
                                Pixmap icon_pixmap,
--- a/src/keyboard.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/keyboard.c	Sun Aug 15 22:50:44 2010 +0000
@@ -4941,9 +4941,9 @@
     0,               /* VK_OEM_102        0xE2 */
     "ico-help",      /* VK_ICO_HELP       0xE3 */
     "ico-00",        /* VK_ICO_00         0xE4 */
-    0,               /* VK_PROCESSKEY     0xE5 */
+    0,               /* VK_PROCESSKEY     0xE5 - used by IME */
     "ico-clear",     /* VK_ICO_CLEAR      0xE6 */
-    "packet",        /* VK_PACKET         0xE7 */
+    0,               /* VK_PACKET         0xE7  - used to pass unicode chars */
     0,               /*                   0xE8 */
     "reset",         /* VK_OEM_RESET      0xE9 */
     "jump",          /* VK_OEM_JUMP       0xEA */
@@ -8285,12 +8285,15 @@
 	    return 0;
 	}
       else if (EQ (key, QChelp))
-	/* `:help HELP-STRING'.  */
-	PROP (TOOL_BAR_ITEM_HELP) = value;
+        /* `:help HELP-STRING'.  */
+        PROP (TOOL_BAR_ITEM_HELP) = value;
       else if (EQ (key, QClabel))
         {
+          const char *bad_label = "!!?GARBLED ITEM?!!";
           /* `:label LABEL-STRING'.  */
-          PROP (TOOL_BAR_ITEM_LABEL) = value;
+          PROP (TOOL_BAR_ITEM_HELP) = STRINGP (value)
+            ? value
+            : make_string (bad_label, strlen (bad_label));
           have_label = 1;
         }
       else if (EQ (key, QCfilter))
@@ -8328,39 +8331,41 @@
       Lisp_Object capt = PROP (TOOL_BAR_ITEM_CAPTION);
       const char *label = SYMBOLP (key) ? (char *) SDATA (SYMBOL_NAME (key)) : "";
       const char *caption = STRINGP (capt) ? (char *) SDATA (capt) : "";
-      char buf[64];
-      EMACS_INT max_lbl = 2*tool_bar_max_label_size;
+      EMACS_INT max_lbl = 2 * tool_bar_max_label_size;
+      char *buf = (char *) xmalloc (max_lbl + 1);
       Lisp_Object new_lbl;
-
-      if (strlen (caption) < max_lbl && caption[0] != '\0')
+      size_t caption_len = strlen (caption);
+
+      if (caption_len <= max_lbl && caption[0] != '\0')
         {
           strcpy (buf, caption);
-          while (buf[0] != '\0' &&  buf[strlen (buf) -1] == '.')
-            buf[strlen (buf)-1] = '\0';
-          if (strlen (buf) <= max_lbl)
-            caption = buf;
+          while (caption_len > 0 && buf[caption_len - 1] == '.')
+            caption_len--;
+	  buf[caption_len] = '\0';
+	  label = caption = buf;
         }
 
-      if (strlen (caption) <= max_lbl)
-        label = caption;
-
       if (strlen (label) <= max_lbl && label[0] != '\0')
         {
           int i;
-          if (label != buf) strcpy (buf, label);
-
-          for (i = 0; i < strlen (buf); ++i)
-            {
-              if (buf[i] == '-') buf[i] = ' ';
-            }
+          if (label != buf)
+	    strcpy (buf, label);
+
+          for (i = 0; buf[i] != '\0'; ++i)
+	    if (buf[i] == '-')
+	      buf[i] = ' ';
           label = buf;
 
         }
-      else label = "";
+      else
+	label = "";
 
       new_lbl = Fupcase_initials (make_string (label, strlen (label)));
       if (SCHARS (new_lbl) <= tool_bar_max_label_size)
         PROP (TOOL_BAR_ITEM_LABEL) = new_lbl;
+      else
+        PROP (TOOL_BAR_ITEM_LABEL) = make_string ("", 0);
+      free (buf);
     }
 
   /* If got a filter apply it on binding.  */
--- a/src/keyboard.h	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/keyboard.h	Sun Aug 15 22:50:44 2010 +0000
@@ -318,10 +318,7 @@
 #define ENCODE_MENU_STRING(str) (str)
 #endif
 
-#if defined (HAVE_NS) || defined (HAVE_NTGUI)
-
-typedef void * XtPointer;
-typedef unsigned char Boolean;
+#if defined (HAVE_NS) || defined (HAVE_NTGUI) || defined (USE_GTK)
 
 /* Definitions copied from lwlib.h */
 
@@ -338,32 +335,35 @@
 {
   /* name of widget */
   Lisp_Object   lname;
-  char*		name;
+  const char*	name;
   /* value (meaning depend on widget type) */
-  char*		value;
+  const char*	value;
   /* keyboard equivalent. no implications for XtTranslations */
   Lisp_Object   lkey;
-  char*		key;
+  const char*	key;
   /* Help string or nil if none.
      GC finds this string through the frame's menu_bar_vector
      or through menu_items.  */
   Lisp_Object	help;
   /* true if enabled */
-  Boolean	enabled;
+  unsigned char	enabled;
   /* true if selected */
-  Boolean	selected;
+  unsigned char selected;
   /* The type of a button.  */
   enum button_type button_type;
 #if defined (HAVE_NTGUI)
   /* true if menu title */
-  Boolean       title;
+  unsigned char title;
 #endif
   /* Contents of the sub-widgets, also selected slot for checkbox */
   struct _widget_value*	contents;
   /* data passed to callback */
-  XtPointer	call_data;
+  void	*call_data;
   /* next one in the list */
   struct _widget_value*	next;
+#ifdef USE_GTK
+  struct _widget_value *free_list;
+#endif
 } widget_value;
 
 #endif /* HAVE_NS || HAVE_NTGUI */
--- a/src/menu.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/menu.c	Sun Aug 15 22:50:44 2010 +0000
@@ -1065,7 +1065,7 @@
   Lisp_Object keymap, tem;
   int xpos = 0, ypos = 0;
   Lisp_Object title;
-  char *error_name = NULL;
+  const char *error_name = NULL;
   Lisp_Object selection = Qnil;
   FRAME_PTR f = NULL;
   Lisp_Object x, y, window;
--- a/src/menu.h	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/menu.h	Sun Aug 15 22:50:44 2010 +0000
@@ -46,11 +46,11 @@
 #endif
 
 extern Lisp_Object w32_menu_show (FRAME_PTR, int, int, int, int,
-				  Lisp_Object, char **);
+				  Lisp_Object, const char **);
 extern Lisp_Object ns_menu_show (FRAME_PTR, int, int, int, int,
-				 Lisp_Object, char **);
+				 Lisp_Object, const char **);
 extern Lisp_Object xmenu_show (FRAME_PTR, int, int, int, int,
-			       Lisp_Object, char **, EMACS_UINT);
+			       Lisp_Object, const char **, EMACS_UINT);
 #endif /* MENU_H */
 
 /* arch-tag: c32b2778-724d-4e85-81d7-45f98530a988
--- a/src/msdos.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/msdos.c	Sun Aug 15 22:50:44 2010 +0000
@@ -68,8 +68,10 @@
 #include <pc.h>
 #include <ctype.h>
 /* #include <process.h> */
-/* Damn that local process.h!  Instead we can define P_WAIT ourselves.  */
+/* Damn that local process.h!  Instead we can define P_WAIT and
+   spawnve ourselves.  */
 #define P_WAIT 1
+extern int spawnve (int, const char *, char *const [], char *const []);
 
 #ifndef _USE_LFN
 #define _USE_LFN 0
@@ -827,7 +829,7 @@
       bg = tem2;
     }
   if (tty->termscript)
-    fprintf (tty->termscript, "<FACE %d: %d/%d[FG:%d/BG:%d]>", face,
+    fprintf (tty->termscript, "<FACE %d: %lu/%lu[FG:%lu/BG:%lu]>", face,
 	     fp->foreground, fp->background, fg, bg);
   if (fg >= 0 && fg < 16)
     {
@@ -859,12 +861,6 @@
   struct frame *sf;
   unsigned char *conversion_buffer;
 
-  /* Do we need to consider conversion of unibyte characters to
-     multibyte?  */
-  int convert_unibyte_characters
-    = (NILP (current_buffer->enable_multibyte_characters)
-       && unibyte_display_via_language_environment);
-
   /* If terminal_coding does any conversion, use it, otherwise use
      safe_terminal_coding.  We can't use CODING_REQUIRE_ENCODING here
      because it always returns 1 if terminal_coding.src_multibyte is 1.  */
@@ -1180,8 +1176,6 @@
 static void
 IT_note_mode_line_highlight (struct window *w, int x, int mode_line_p)
 {
-  struct frame *f = XFRAME (w->frame);
-  struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
   struct glyph_row *row;
 
   if (mode_line_p)
@@ -1192,7 +1186,7 @@
   if (row->enabled_p)
     {
       struct glyph *glyph, *end;
-      Lisp_Object help, map;
+      Lisp_Object help;
 
       /* Find the glyph under X.  */
       glyph = (row->glyphs[TEXT_AREA]
@@ -1873,6 +1867,8 @@
 void
 x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 {
+  extern void set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
+
   set_menu_bar_lines (f, value, oldval);
 }
 
@@ -1939,7 +1935,7 @@
 	   already point to the relocated buffer address returned by
 	   the Int 10h/AX=FEh call above.  DJGPP v2.02 and later sets
 	   ScreenPrimary to that address at startup under DOS/V.  */
-	if (regs.x.es != (ScreenPrimary >> 4) & 0xffff)
+	if (regs.x.es != ((ScreenPrimary >> 4) & 0xffff))
 	  screen_old_address = ScreenPrimary;
 	screen_virtual_segment = regs.x.es;
 	screen_virtual_offset  = regs.x.di;
@@ -2056,6 +2052,8 @@
      frame colors are reversed.  */
   initial_screen_colors[0] = FRAME_FOREGROUND_PIXEL (f);
   initial_screen_colors[1] = FRAME_BACKGROUND_PIXEL (f);
+
+  return Qnil;
 }
 
 void
@@ -2071,7 +2069,6 @@
   int reverse = EQ (Fcdr (Fassq (Qreverse, f->param_alist)), Qt);
   int redraw = 0, fg_set = 0, bg_set = 0;
   unsigned long orig_fg, orig_bg;
-  Lisp_Object frame_bg, frame_fg;
   struct tty_display_info *tty = FRAME_TTY (f);
 
   /* If we are creating a new frame, begin with the original screen colors
@@ -2195,9 +2192,10 @@
 	  IT_set_cursor_type (f, val);
 	  if (tty->termscript)
 	    fprintf (tty->termscript, "<CTYPE: %s>\n",
-		     EQ (val, Qbar) || EQ (val, Qhbar)
-		     || CONSP (val) && (EQ (XCAR (val), Qbar)
-					|| EQ (XCAR (val), Qhbar))
+		     EQ (val, Qbar)
+		     || EQ (val, Qhbar)
+		     || (CONSP (val) && (EQ (XCAR (val), Qbar)
+					 || EQ (XCAR (val), Qhbar)))
 		     ? "bar" : "box");
 	}
       else if (EQ (prop, Qtty_type))
@@ -2214,8 +2212,6 @@
      the current frame colors.  */
   if (reverse)
     {
-      Lisp_Object frame;
-
       if (!fg_set)
 	{
 	  FRAME_FOREGROUND_PIXEL (f) = orig_bg;
@@ -2532,11 +2528,11 @@
   struct dos_keyboard_map *keyboard_map;
 } keyboard_layout_list[] =
 {
-  1, &us_keyboard,
-  33, &fr_keyboard,
-  39, &it_keyboard,
-  45, &dk_keyboard,
-  81, &jp_keyboard
+  { 1, &us_keyboard },
+  { 33, &fr_keyboard },
+  { 39, &it_keyboard },
+  { 45, &dk_keyboard },
+  { 81, &jp_keyboard }
 };
 
 static struct dos_keyboard_map *keyboard;
@@ -2581,17 +2577,17 @@
   unsigned char keypad_code;	/* keypad code	*/
   unsigned char editkey_code;	/* edit key	*/
 } keypad_translate_map[] = {
-  '0',  '0',  0xb0, /* kp-0 */		0x63, /* insert */
-  '1',  '1',  0xb1, /* kp-1 */		0x57, /* end */
-  '2',  '2',  0xb2, /* kp-2 */		0x54, /* down */
-  '3',  '3',  0xb3, /* kp-3 */		0x56, /* next */
-  '4',  '4',  0xb4, /* kp-4 */		0x51, /* left */
-  '5',  '5',  0xb5, /* kp-5 */		0xb5, /* kp-5 */
-  '6',  '6',  0xb6, /* kp-6 */		0x53, /* right */
-  '7',  '7',  0xb7, /* kp-7 */		0x50, /* home */
-  '8',  '8',  0xb8, /* kp-8 */		0x52, /* up */
-  '9',  '9',  0xb9, /* kp-9 */		0x55, /* prior */
-  '.',  '-',  0xae, /* kp-decimal */	0xff  /* delete */
+  { '0',  '0',  0xb0, /* kp-0 */		0x63 /* insert */ },
+  { '1',  '1',  0xb1, /* kp-1 */		0x57 /* end */    },
+  { '2',  '2',  0xb2, /* kp-2 */		0x54 /* down */   },
+  { '3',  '3',  0xb3, /* kp-3 */		0x56 /* next */   },
+  { '4',  '4',  0xb4, /* kp-4 */		0x51 /* left */   },
+  { '5',  '5',  0xb5, /* kp-5 */		0xb5 /* kp-5 */   },
+  { '6',  '6',  0xb6, /* kp-6 */		0x53 /* right */  },
+  { '7',  '7',  0xb7, /* kp-7 */		0x50 /* home */   },
+  { '8',  '8',  0xb8, /* kp-8 */		0x52 /* up */     },
+  { '9',  '9',  0xb9, /* kp-9 */		0x55 /* prior */  },
+  { '.',  '-',  0xae, /* kp-decimal */		0xff  /* delete */}
 };
 
 static struct
@@ -2599,11 +2595,11 @@
   unsigned char char_code;	/* normal code	*/
   unsigned char keypad_code;	/* keypad code	*/
 } grey_key_translate_map[] = {
-  '/',  0xaf, /* kp-decimal */
-  '*',  0xaa, /* kp-multiply */
-  '-',  0xad, /* kp-subtract */
-  '+',  0xab, /* kp-add */
-  '\r', 0x8d  /* kp-enter */
+  { '/',  0xaf /* kp-decimal */  },
+  { '*',  0xaa /* kp-multiply */ },
+  { '-',  0xad /* kp-subtract */ },
+  { '+',  0xab /* kp-add */      },
+  { '\r', 0x8d  /* kp-enter */   }
 };
 
 static unsigned short
@@ -3129,7 +3125,6 @@
 	  break;
 	}
 
-    make_event:
       if (code == 0)
 	continue;
 
@@ -3237,14 +3232,14 @@
 		    /* If only one button is pressed, wait 100 msec and
 		       check again.  This way, Speedy Gonzales isn't
 		       punished, while the slow get their chance.  */
-		    if (press && mouse_pressed (1-but, &x2, &y2)
-			|| !press && mouse_released (1-but, &x2, &y2))
+		    if ((press && mouse_pressed (1-but, &x2, &y2))
+			|| (!press && mouse_released (1-but, &x2, &y2)))
 		      button_num = 2;
 		    else
 		      {
 			delay (100);
-			if (press && mouse_pressed (1-but, &x2, &y2)
-			    || !press && mouse_released (1-but, &x2, &y2))
+			if ((press && mouse_pressed (1-but, &x2, &y2))
+			    || (!press && mouse_released (1-but, &x2, &y2)))
 			  button_num = 2;
 		      }
 		  }
@@ -3680,10 +3675,12 @@
 		if (0 <= dy && dy < state[i].menu->count)
 		  {
 		    if (!state[i].menu->submenu[dy])
-		      if (state[i].menu->panenumber[dy])
-			result = XM_SUCCESS;
-		      else
-			result = XM_IA_SELECT;
+		      {
+			if (state[i].menu->panenumber[dy])
+			  result = XM_SUCCESS;
+			else
+			  result = XM_IA_SELECT;
+		      }
 		    *pane = state[i].pane - 1;
 		    *selidx = dy;
 		    /* We hit some part of a menu, so drop extra menus that
@@ -4181,7 +4178,7 @@
   /* If we are called for the initial terminal, it's too early to do
      anything, and termscript isn't set up.  */
   if (tty->terminal->type == output_initial)
-    return;
+    return 2;
 
   break_stat = getcbrk ();
   setcbrk (0);
@@ -4367,7 +4364,7 @@
 	result = 0;	/* emulate Unixy shell behavior with empty cmd line */
     }
   else
-    result = spawnve (P_WAIT, argv[0], argv, envv);
+    result = spawnve (P_WAIT, argv[0], (char **)argv, envv);
 
   dup2 (inbak, 0);
   dup2 (outbak, 1);
--- a/src/nsfont.m	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/nsfont.m	Sun Aug 15 22:50:44 2010 +0000
@@ -161,7 +161,9 @@
 
 /* Converts NSFont descriptor to FONT_WEIGHT, FONT_SLANT, FONT_WIDTH, etc.. */
 static Lisp_Object
-ns_descriptor_to_entity (NSFontDescriptor *desc, Lisp_Object extra, char *style)
+ns_descriptor_to_entity (NSFontDescriptor *desc,
+                         Lisp_Object extra,
+                         const char *style)
 {
     Lisp_Object font_entity = font_make_entity ();
     /*   NSString *psName = [desc postscriptName]; */
--- a/src/nsmenu.m	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/nsmenu.m	Sun Aug 15 22:50:44 2010 +0000
@@ -600,9 +600,9 @@
    NSMenuItem get ignored.  For now we try to display a super-single letter
    combo, and return the others as strings to be appended to the item title.
    (This is signaled by setting keyEquivModMask to 0 for now.) */
--(NSString *)parseKeyEquiv: (char *)key
+-(NSString *)parseKeyEquiv: (const char *)key
 {
-  char *tpos = key;
+  const char *tpos = key;
   keyEquivModMask = NSCommandKeyMask;
 
   if (!key || !strlen (key))
@@ -719,7 +719,7 @@
 
 
 /* adds an empty submenu and returns it */
-- (EmacsMenu *)addSubmenuWithTitle: (char *)title forFrame: (struct frame *)f
+- (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f
 {
   NSString *titleStr = [NSString stringWithUTF8String: title];
   NSMenuItem *item = [self addItemWithTitle: titleStr
@@ -773,7 +773,7 @@
 
 Lisp_Object
 ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
-	      Lisp_Object title, char **error)
+	      Lisp_Object title, const char **error)
 {
   EmacsMenu *pmenu;
   NSPoint p;
@@ -836,7 +836,7 @@
 	{
 	  /* Create a new pane.  */
 	  Lisp_Object pane_name, prefix;
-	  char *pane_string;
+	  const char *pane_string;
 
 	  pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
 	  prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
@@ -1033,7 +1033,7 @@
       struct image *img;
       Lisp_Object image;
       Lisp_Object helpObj;
-      char *helpText;
+      const char *helpText;
 
       /* If image is a vector, choose the image according to the
 	 button state.  */
@@ -1153,7 +1153,7 @@
 }
 
 - (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx
-                        helpText: (char *)help enabled: (BOOL)enabled
+                        helpText: (const char *)help enabled: (BOOL)enabled
 {
   /* 1) come up w/identifier */
   NSString *identifier
--- a/src/nsterm.h	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/nsterm.h	Sun Aug 15 22:50:44 2010 +0000
@@ -114,10 +114,10 @@
 - initWithTitle: (NSString *)title frame: (struct frame *)f;
 - (void)setFrame: (struct frame *)f;
 - (void)menuNeedsUpdate: (NSMenu *)menu; /* (delegate method) */
-- (NSString *)parseKeyEquiv: (char *)key;
+- (NSString *)parseKeyEquiv: (const char *)key;
 - (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr;
 - (void)fillWithWidgetValue: (void *)wvptr;
-- (EmacsMenu *)addSubmenuWithTitle: (char *)title forFrame: (struct frame *)f;
+- (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f;
 - (void) clear;
 - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
                  keymaps: (int)keymaps;
@@ -144,7 +144,7 @@
 - (void) clearActive;
 - (BOOL) changed;
 - (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx
-                        helpText: (char *)help
+                        helpText: (const char *)help
                          enabled: (BOOL)enabled;
 /* delegate methods */
 - (NSToolbarItem *)toolbar: (NSToolbar *)toolbar
--- a/src/process.h	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/process.h	Sun Aug 15 22:50:44 2010 +0000
@@ -142,7 +142,7 @@
    to Fcall_process.  */
 
 /* Nonzero => this is a string explaining death of synchronous subprocess.  */
-extern char *synch_process_death;
+extern const char *synch_process_death;
 
 /* Nonzero => this is the signal number that terminated the subprocess.  */
 extern int synch_process_termsig;
--- a/src/syntax.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/syntax.c	Sun Aug 15 22:50:44 2010 +0000
@@ -34,6 +34,60 @@
 
 #include "syntax.h"
 #include "intervals.h"
+#include "category.h"
+
+/* Then there are seven single-bit flags that have the following meanings:
+  1. This character is the first of a two-character comment-start sequence.
+  2. This character is the second of a two-character comment-start sequence.
+  3. This character is the first of a two-character comment-end sequence.
+  4. This character is the second of a two-character comment-end sequence.
+  5. This character is a prefix, for backward-prefix-chars.
+  6. The char is part of a delimiter for comments of style "b".
+  7. This character is part of a nestable comment sequence.
+  8. The char is part of a delimiter for comments of style "c".
+  Note that any two-character sequence whose first character has flag 1
+  and whose second character has flag 2 will be interpreted as a comment start.
+
+  bit 6 and 8 are used to discriminate between different comment styles.
+  Languages such as C++ allow two orthogonal syntax start/end pairs
+  and bit 6 is used to determine whether a comment-end or Scommentend
+  ends style a or b.  Comment markers can start style a, b, c, or bc.
+  Style a is always the default.
+  For 2-char comment markers, the style b flag is only looked up on the second
+  char of the comment marker and on the first char of the comment ender.
+  For style c (like to for the nested flag), the flag can be placed on any
+  one of the chars.
+  */
+
+/* These macros extract specific flags from an integer
+   that holds the syntax code and the flags.  */
+
+#define SYNTAX_FLAGS_COMSTART_FIRST(flags) (((flags) >> 16) & 1)
+
+#define SYNTAX_FLAGS_COMSTART_SECOND(flags) (((flags) >> 17) & 1)
+
+#define SYNTAX_FLAGS_COMEND_FIRST(flags) (((flags) >> 18) & 1)
+
+#define SYNTAX_FLAGS_COMEND_SECOND(flags) (((flags) >> 19) & 1)
+
+#define SYNTAX_FLAGS_PREFIX(flags) (((flags) >> 20) & 1)
+
+#define SYNTAX_FLAGS_COMMENT_STYLEB(flags) (((flags) >> 21) & 1)
+#define SYNTAX_FLAGS_COMMENT_STYLEC(flags) (((flags) >> 22) & 2)
+/* FLAGS should be the flags of the main char of the comment marker, e.g.
+   the second for comstart and the first for comend.  */
+#define SYNTAX_FLAGS_COMMENT_STYLE(flags, other_flags) \
+  (SYNTAX_FLAGS_COMMENT_STYLEB (flags) \
+   | SYNTAX_FLAGS_COMMENT_STYLEC (flags) \
+   | SYNTAX_FLAGS_COMMENT_STYLEC (other_flags))
+
+#define SYNTAX_FLAGS_COMMENT_NESTED(flags) (((flags) >> 22) & 1)
+
+/* These macros extract a particular flag for a given character.  */
+
+#define SYNTAX_COMEND_FIRST(c) \
+  (SYNTAX_FLAGS_COMEND_FIRST (SYNTAX_WITH_FLAGS (c)))
+#define SYNTAX_PREFIX(c) (SYNTAX_FLAGS_PREFIX (SYNTAX_WITH_FLAGS (c)))
 
 /* We use these constants in place for comment-style and
    string-ender-char to distinguish  comments/strings started by
@@ -41,7 +95,6 @@
 
 #define ST_COMMENT_STYLE (256 + 1)
 #define ST_STRING_STYLE (256 + 2)
-#include "category.h"
 
 Lisp_Object Qsyntax_table_p, Qsyntax_table, Qscan_error;
 
@@ -106,6 +159,11 @@
                                 int, Lisp_Object, int);
 static int in_classes (int, Lisp_Object);
 
+/* Whether the syntax of the character C has the prefix flag set.  */
+int syntax_prefix_flag_p (int c)
+{
+  return SYNTAX_PREFIX (c);
+}
 
 struct gl_state_s gl_state;		/* Global state of syntax parser.  */
 
@@ -514,7 +572,8 @@
       /* Check for 2-char comment markers.  */
       com2start = (SYNTAX_FLAGS_COMSTART_FIRST (syntax)
 		   && SYNTAX_FLAGS_COMSTART_SECOND (prev_syntax)
-		   && comstyle == SYNTAX_FLAGS_COMMENT_STYLE (prev_syntax)
+		   && (comstyle
+		       == SYNTAX_FLAGS_COMMENT_STYLE (prev_syntax, syntax))
 		   && (SYNTAX_FLAGS_COMMENT_NESTED (prev_syntax)
 		       || SYNTAX_FLAGS_COMMENT_NESTED (syntax)) == comnested);
       com2end = (SYNTAX_FLAGS_COMEND_FIRST (syntax)
@@ -543,7 +602,8 @@
 	       && SYNTAX_FLAGS_COMEND_FIRST (next_syntax))
 	      || ((com2end || comnested)
 		  && SYNTAX_FLAGS_COMSTART_SECOND (syntax)
-		  && comstyle == SYNTAX_FLAGS_COMMENT_STYLE (syntax)
+		  && (comstyle
+		      == SYNTAX_FLAGS_COMMENT_STYLE (syntax, prev_syntax))
 		  && SYNTAX_FLAGS_COMSTART_FIRST (next_syntax)))
 	    goto lossage;
 	  /* UPDATE_SYNTAX_TABLE_FORWARD (next + 1); */
@@ -563,7 +623,7 @@
 	code = Scomment;
       /* Ignore comment starters of a different style.  */
       else if (code == Scomment
-	       && (comstyle != SYNTAX_FLAGS_COMMENT_STYLE (syntax)
+	       && (comstyle != SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0)
 		   || SYNTAX_FLAGS_COMMENT_NESTED (syntax) != comnested))
 	continue;
 
@@ -613,7 +673,7 @@
 	  break;
 
 	case Sendcomment:
-	  if (SYNTAX_FLAGS_COMMENT_STYLE (syntax) == comstyle
+	  if (SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == comstyle
 	      && ((com2end && SYNTAX_FLAGS_COMMENT_NESTED (prev_syntax))
 		  || SYNTAX_FLAGS_COMMENT_NESTED (syntax)) == comnested)
 	    /* This is the same style of comment ender as ours. */
@@ -930,6 +990,10 @@
       case 'n':
 	val |= 1 << 22;
 	break;
+
+      case 'c':
+	val |= 1 << 23;
+	break;
       }
 
   if (val < XVECTOR (Vsyntax_code_object)->size && NILP (match))
@@ -969,12 +1033,13 @@
  3 means CHAR is the start of a two-char comment end sequence.
  4 means CHAR is the second character of such a sequence.
 
-There can be up to two orthogonal comment sequences.  This is to support
+There can be several orthogonal comment sequences.  This is to support
 language modes such as C++.  By default, all comment sequences are of style
 a, but you can set the comment sequence style to b (on the second character
-of a comment-start, or the first character of a comment-end sequence) using
-this flag:
+of a comment-start, and the first character of a comment-end sequence) and/or
+c (on any of its chars) using this flag:
  b means CHAR is part of comment sequence b.
+ c means CHAR is part of comment sequence c.
  n means CHAR is part of a nestable comment sequence.
 
  p means CHAR is a prefix character for `backward-prefix-chars';
@@ -1017,7 +1082,9 @@
   (Lisp_Object syntax)
 {
   register enum syntaxcode code;
-  char desc, start1, start2, end1, end2, prefix, comstyle, comnested;
+  int syntax_code;
+  char desc, start1, start2, end1, end2, prefix,
+    comstyleb, comstylec, comnested;
   char str[2];
   Lisp_Object first, match_lisp, value = syntax;
 
@@ -1048,14 +1115,16 @@
       return syntax;
     }
 
-  code = (enum syntaxcode) (XINT (first) & 0377);
-  start1 = (XINT (first) >> 16) & 1;
-  start2 = (XINT (first) >> 17) & 1;
-  end1 = (XINT (first) >> 18) & 1;
-  end2 = (XINT (first) >> 19) & 1;
-  prefix = (XINT (first) >> 20) & 1;
-  comstyle = (XINT (first) >> 21) & 1;
-  comnested = (XINT (first) >> 22) & 1;
+  syntax_code = XINT (first);
+  code = (enum syntaxcode) (syntax_code & 0377);
+  start1 = SYNTAX_FLAGS_COMSTART_FIRST (syntax_code);
+  start2 = SYNTAX_FLAGS_COMSTART_SECOND (syntax_code);;
+  end1 = SYNTAX_FLAGS_COMEND_FIRST (syntax_code);
+  end2 = SYNTAX_FLAGS_COMEND_SECOND (syntax_code);
+  prefix = SYNTAX_FLAGS_PREFIX (syntax_code);
+  comstyleb = SYNTAX_FLAGS_COMMENT_STYLEB (syntax_code);
+  comstylec = SYNTAX_FLAGS_COMMENT_STYLEC (syntax_code);
+  comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax_code);
 
   if ((int) code < 0 || (int) code >= (int) Smax)
     {
@@ -1084,8 +1153,10 @@
 
   if (prefix)
     insert ("p", 1);
-  if (comstyle)
+  if (comstyleb)
     insert ("b", 1);
+  if (comstylec)
+    insert ("c", 1);
   if (comnested)
     insert ("n", 1);
 
@@ -1145,8 +1216,10 @@
     insert_string (",\n\t  is the first character of a comment-end sequence");
   if (end2)
     insert_string (",\n\t  is the second character of a comment-end sequence");
-  if (comstyle)
+  if (comstyleb)
     insert_string (" (comment style b)");
+  if (comstylec)
+    insert_string (" (comment style c)");
   if (comnested)
     insert_string (" (nestable)");
 
@@ -2060,7 +2133,7 @@
    FROM_BYTE is the bytepos corresponding to FROM.
    Do not move past STOP (a charpos).
    The comment over which we have to jump is of style STYLE
-     (either SYNTAX_COMMENT_STYLE(foo) or ST_COMMENT_STYLE).
+     (either SYNTAX_FLAGS_COMMENT_STYLE(foo) or ST_COMMENT_STYLE).
    NESTING should be positive to indicate the nesting at the beginning
      for nested comments and should be zero or negative else.
      ST_COMMENT_STYLE cannot be nested.
@@ -2087,7 +2160,7 @@
 {
   register int c, c1;
   register enum syntaxcode code;
-  register int syntax;
+  register int syntax, other_syntax;
 
   if (nesting <= 0) nesting = -1;
 
@@ -2109,7 +2182,7 @@
       syntax = SYNTAX_WITH_FLAGS (c);
       code = syntax & 0xff;
       if (code == Sendcomment
-	  && SYNTAX_FLAGS_COMMENT_STYLE (syntax) == style
+	  && SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == style
 	  && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) ?
 	      (nesting > 0 && --nesting == 0) : nesting < 0))
 	/* we have encountered a comment end of the same style
@@ -2125,7 +2198,7 @@
       if (nesting > 0
 	  && code == Scomment
 	  && SYNTAX_FLAGS_COMMENT_NESTED (syntax)
-	  && SYNTAX_FLAGS_COMMENT_STYLE (syntax) == style)
+	  && SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == style)
 	/* we have encountered a nested comment of the same style
 	   as the comment sequence which began this comment section */
 	nesting++;
@@ -2134,11 +2207,13 @@
 
     forw_incomment:
       if (from < stop && SYNTAX_FLAGS_COMEND_FIRST (syntax)
-	  && SYNTAX_FLAGS_COMMENT_STYLE (syntax) == style
 	  && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte),
-	      SYNTAX_COMEND_SECOND (c1))
+	      other_syntax = SYNTAX_WITH_FLAGS (c1),
+	      SYNTAX_FLAGS_COMEND_SECOND (other_syntax))
+	  && SYNTAX_FLAGS_COMMENT_STYLE (syntax, other_syntax) == style
 	  && ((SYNTAX_FLAGS_COMMENT_NESTED (syntax) ||
-	       SYNTAX_COMMENT_NESTED (c1)) ? nesting > 0 : nesting < 0))
+	       SYNTAX_FLAGS_COMMENT_NESTED (other_syntax))
+	      ? nesting > 0 : nesting < 0))
 	{
 	  if (--nesting <= 0)
 	    /* we have encountered a comment end of the same style
@@ -2155,10 +2230,11 @@
 	  && from < stop
 	  && SYNTAX_FLAGS_COMSTART_FIRST (syntax)
 	  && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte),
-	      SYNTAX_COMMENT_STYLE (c1) == style
-	      && SYNTAX_COMSTART_SECOND (c1))
+	      other_syntax = SYNTAX_WITH_FLAGS (c1),
+	      SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax) == style
+	      && SYNTAX_FLAGS_COMSTART_SECOND (other_syntax))
 	  && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) ||
-	      SYNTAX_COMMENT_NESTED (c1)))
+	      SYNTAX_FLAGS_COMMENT_NESTED (other_syntax)))
 	/* we have encountered a nested comment of the same style
 	   as the comment sequence which began this comment
 	   section */
@@ -2209,7 +2285,7 @@
     {
       do
 	{
-	  int comstart_first;
+	  int comstart_first, syntax, other_syntax;
 
 	  if (from == stop)
 	    {
@@ -2218,15 +2294,17 @@
 	      return Qnil;
 	    }
 	  c = FETCH_CHAR_AS_MULTIBYTE (from_byte);
+	  syntax = SYNTAX_WITH_FLAGS (c);
 	  code = SYNTAX (c);
-	  comstart_first = SYNTAX_COMSTART_FIRST (c);
-	  comnested = SYNTAX_COMMENT_NESTED (c);
-	  comstyle = SYNTAX_COMMENT_STYLE (c);
+	  comstart_first = SYNTAX_FLAGS_COMSTART_FIRST (syntax);
+	  comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax);
+	  comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0);
 	  INC_BOTH (from, from_byte);
 	  UPDATE_SYNTAX_TABLE_FORWARD (from);
 	  if (from < stop && comstart_first
 	      && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte),
-		  SYNTAX_COMSTART_SECOND (c1)))
+		  other_syntax = SYNTAX_WITH_FLAGS (c1),
+		  SYNTAX_FLAGS_COMSTART_SECOND (other_syntax)))
 	    {
 	      /* We have encountered a comment start sequence and we
 		 are ignoring all text inside comments.  We must record
@@ -2234,8 +2312,9 @@
 		 only a comment end of the same style actually ends
 		 the comment section.  */
 	      code = Scomment;
-	      comstyle = SYNTAX_COMMENT_STYLE (c1);
-	      comnested = comnested || SYNTAX_COMMENT_NESTED (c1);
+	      comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax);
+	      comnested
+		= comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax);
 	      INC_BOTH (from, from_byte);
 	      UPDATE_SYNTAX_TABLE_FORWARD (from);
 	    }
@@ -2271,7 +2350,7 @@
     {
       while (1)
 	{
-	  int quoted;
+	  int quoted, syntax;
 
 	  if (from <= stop)
 	    {
@@ -2284,15 +2363,17 @@
 	  /* char_quoted does UPDATE_SYNTAX_TABLE_BACKWARD (from).  */
 	  quoted = char_quoted (from, from_byte);
 	  c = FETCH_CHAR_AS_MULTIBYTE (from_byte);
+	  syntax = SYNTAX_WITH_FLAGS (c);
 	  code = SYNTAX (c);
 	  comstyle = 0;
-	  comnested = SYNTAX_COMMENT_NESTED (c);
+	  comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax);
 	  if (code == Sendcomment)
-	    comstyle = SYNTAX_COMMENT_STYLE (c);
-	  if (from > stop && SYNTAX_COMEND_SECOND (c)
+	    comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0);
+	  if (from > stop && SYNTAX_FLAGS_COMEND_SECOND (syntax)
 	      && prev_char_comend_first (from, from_byte)
 	      && !char_quoted (from - 1, dec_bytepos (from_byte)))
 	    {
+	      int other_syntax;
 	      /* We must record the comment style encountered so that
 		 later, we can match only the proper comment begin
 		 sequence of the same style.  */
@@ -2301,8 +2382,10 @@
 	      /* Calling char_quoted, above, set up global syntax position
 		 at the new value of FROM.  */
 	      c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte);
-	      comstyle = SYNTAX_COMMENT_STYLE (c1);
-	      comnested = comnested || SYNTAX_COMMENT_NESTED (c1);
+	      other_syntax = SYNTAX_WITH_FLAGS (c1);
+	      comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax);
+	      comnested
+		= comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax);
 	    }
 
 	  if (code == Scomment_fence)
@@ -2349,7 +2432,7 @@
 		    {
 		      /* Failure: we should go back to the end of this
 			 not-quite-endcomment.  */
-		      if (SYNTAX(c) != code)
+		      if (SYNTAX (c) != code)
 			/* It was a two-char Sendcomment.  */
 			INC_BOTH (from, from_byte);
 		      goto leave;
@@ -2423,21 +2506,23 @@
     {
       while (from < stop)
 	{
-	  int comstart_first, prefix;
+	  int comstart_first, prefix, syntax, other_syntax;
 	  UPDATE_SYNTAX_TABLE_FORWARD (from);
 	  c = FETCH_CHAR_AS_MULTIBYTE (from_byte);
+	  syntax = SYNTAX_WITH_FLAGS (c);
 	  code = SYNTAX_WITH_MULTIBYTE_CHECK (c);
-	  comstart_first = SYNTAX_COMSTART_FIRST (c);
-	  comnested = SYNTAX_COMMENT_NESTED (c);
-	  comstyle = SYNTAX_COMMENT_STYLE (c);
-	  prefix = SYNTAX_PREFIX (c);
+	  comstart_first = SYNTAX_FLAGS_COMSTART_FIRST (syntax);
+	  comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax);
+	  comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0);
+	  prefix = SYNTAX_FLAGS_PREFIX (syntax);
 	  if (depth == min_depth)
 	    last_good = from;
 	  INC_BOTH (from, from_byte);
 	  UPDATE_SYNTAX_TABLE_FORWARD (from);
 	  if (from < stop && comstart_first
 	      && (c = FETCH_CHAR_AS_MULTIBYTE (from_byte),
-		  SYNTAX_COMSTART_SECOND (c))
+		  other_syntax = SYNTAX_WITH_FLAGS (c),
+		  SYNTAX_FLAGS_COMSTART_SECOND (other_syntax))
 	      && parse_sexp_ignore_comments)
 	    {
 	      /* we have encountered a comment start sequence and we
@@ -2446,9 +2531,9 @@
 		 only a comment end of the same style actually ends
 		 the comment section */
 	      code = Scomment;
-	      c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte);
-	      comstyle = SYNTAX_COMMENT_STYLE (c1);
-	      comnested = comnested || SYNTAX_COMMENT_NESTED (c1);
+	      comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax);
+	      comnested
+		= comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax);
 	      INC_BOTH (from, from_byte);
 	      UPDATE_SYNTAX_TABLE_FORWARD (from);
 	    }
@@ -2592,29 +2677,34 @@
     {
       while (from > stop)
 	{
+	  int syntax;
 	  DEC_BOTH (from, from_byte);
 	  UPDATE_SYNTAX_TABLE_BACKWARD (from);
 	  c = FETCH_CHAR_AS_MULTIBYTE (from_byte);
+	  syntax= SYNTAX_WITH_FLAGS (c);
 	  code = SYNTAX_WITH_MULTIBYTE_CHECK (c);
 	  if (depth == min_depth)
 	    last_good = from;
 	  comstyle = 0;
-	  comnested = SYNTAX_COMMENT_NESTED (c);
+	  comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax);
 	  if (code == Sendcomment)
-	    comstyle = SYNTAX_COMMENT_STYLE (c);
-	  if (from > stop && SYNTAX_COMEND_SECOND (c)
+	    comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0);
+	  if (from > stop && SYNTAX_FLAGS_COMEND_SECOND (syntax)
 	      && prev_char_comend_first (from, from_byte)
 	      && parse_sexp_ignore_comments)
 	    {
 	      /* We must record the comment style encountered so that
 		 later, we can match only the proper comment begin
 		 sequence of the same style.  */
+	      int c1, other_syntax;
 	      DEC_BOTH (from, from_byte);
 	      UPDATE_SYNTAX_TABLE_BACKWARD (from);
 	      code = Sendcomment;
 	      c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte);
-	      comstyle = SYNTAX_COMMENT_STYLE (c1);
-	      comnested = comnested || SYNTAX_COMMENT_NESTED (c1);
+	      other_syntax = SYNTAX_WITH_FLAGS (c1);
+	      comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax);
+	      comnested
+		= comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax);
 	    }
 
 	  /* Quoting turns anything except a comment-ender
@@ -2625,7 +2715,7 @@
 	      DEC_BOTH (from, from_byte);
 	      code = Sword;
 	    }
-	  else if (SYNTAX_PREFIX (c))
+	  else if (SYNTAX_FLAGS_PREFIX (syntax))
 	    continue;
 
 	  switch (SWITCH_ENUM_CAST (code))
@@ -2949,8 +3039,11 @@
       oldstate = Fcdr (oldstate);
       oldstate = Fcdr (oldstate);
       tem = Fcar (oldstate);
-      state.comstyle = NILP (tem) ? 0 : (EQ (tem, Qsyntax_table)
-					 ? ST_COMMENT_STYLE : 1);
+      state.comstyle = (NILP (tem)
+			? 0
+			: (EQ (tem, Qsyntax_table)
+			   ? ST_COMMENT_STYLE
+			   : INTEGERP (tem) ? XINT (tem) : 1));
 
       oldstate = Fcdr (oldstate);
       tem = Fcar (oldstate);
@@ -2995,22 +3088,25 @@
 
   while (from < end)
     {
+      int syntax;
       INC_FROM;
       code = prev_from_syntax & 0xff;
 
       if (from < end
 	  && SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax)
 	  && (c1 = FETCH_CHAR (from_byte),
-	      SYNTAX_COMSTART_SECOND (c1)))
+	      syntax = SYNTAX_WITH_FLAGS (c1),
+	      SYNTAX_FLAGS_COMSTART_SECOND (syntax)))
 	/* Duplicate code to avoid a complex if-expression
 	   which causes trouble for the SGI compiler.  */
 	{
 	  /* Record the comment style we have entered so that only
 	     the comment-end sequence of the same style actually
 	     terminates the comment section.  */
-	  state.comstyle = SYNTAX_COMMENT_STYLE (c1);
+	  state.comstyle
+	    = SYNTAX_FLAGS_COMMENT_STYLE (syntax, prev_from_syntax);
 	  comnested = SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax);
-	  comnested = comnested || SYNTAX_COMMENT_NESTED (c1);
+	  comnested = comnested || SYNTAX_FLAGS_COMMENT_NESTED (syntax);
 	  state.incomment = comnested ? 1 : -1;
 	  state.comstr_start = prev_from;
 	  INC_FROM;
@@ -3028,7 +3124,7 @@
 	}
       else if (code == Scomment)
 	{
-	  state.comstyle = SYNTAX_FLAGS_COMMENT_STYLE (prev_from_syntax);
+	  state.comstyle = SYNTAX_FLAGS_COMMENT_STYLE (prev_from_syntax, 0);
 	  state.incomment = (SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax) ?
 			     1 : -1);
 	  state.comstr_start = prev_from;
@@ -3221,8 +3317,7 @@
     else an integer (the current comment nesting).
  5. t if following a quote character.
  6. the minimum paren-depth encountered during this scan.
- 7. t if in a comment of style b; symbol `syntax-table' if the comment
-    should be terminated by a generic comment delimiter.
+ 7. style of comment, if any.
  8. character address of start of comment or string; nil if not in one.
  9. Intermediate data for continuation of parsing (subject to change).
 If third arg TARGETDEPTH is non-nil, parsing stops if the depth
@@ -3258,8 +3353,10 @@
   SET_PT (state.location);
 
   return Fcons (make_number (state.depth),
-	   Fcons (state.prevlevelstart < 0 ? Qnil : make_number (state.prevlevelstart),
-	     Fcons (state.thislevelstart < 0 ? Qnil : make_number (state.thislevelstart),
+	   Fcons (state.prevlevelstart < 0
+		  ? Qnil : make_number (state.prevlevelstart),
+	     Fcons (state.thislevelstart < 0
+		    ? Qnil : make_number (state.thislevelstart),
 	       Fcons (state.instring >= 0
 		      ? (state.instring == ST_STRING_STYLE
 			 ? Qt : make_number (state.instring)) : Qnil,
@@ -3270,8 +3367,9 @@
 		     Fcons (make_number (state.mindepth),
 		       Fcons ((state.comstyle
 			       ? (state.comstyle == ST_COMMENT_STYLE
-				  ? Qsyntax_table : Qt) :
-			       Qnil),
+				  ? Qsyntax_table
+				  : make_number (state.comstyle))
+			       : Qnil),
 			      Fcons (((state.incomment
 				       || (state.instring >= 0))
 				      ? make_number (state.comstr_start)
--- a/src/syntax.h	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/syntax.h	Sun Aug 15 22:50:44 2010 +0000
@@ -128,56 +128,9 @@
     : Qnil))
 #endif
 
-/* Then there are seven single-bit flags that have the following meanings:
-  1. This character is the first of a two-character comment-start sequence.
-  2. This character is the second of a two-character comment-start sequence.
-  3. This character is the first of a two-character comment-end sequence.
-  4. This character is the second of a two-character comment-end sequence.
-  5. This character is a prefix, for backward-prefix-chars.
-  6. see below
-  7. This character is part of a nestable comment sequence.
-  Note that any two-character sequence whose first character has flag 1
-  and whose second character has flag 2 will be interpreted as a comment start.
 
-  bit 6 is used to discriminate between two different comment styles.
-  Languages such as C++ allow two orthogonal syntax start/end pairs
-  and bit 6 is used to determine whether a comment-end or Scommentend
-  ends style a or b.  Comment start sequences can start style a or b.
-  Style a is always the default.
-  */
-
-/* These macros extract a particular flag for a given character.  */
-
-#define SYNTAX_COMSTART_FIRST(c) ((SYNTAX_WITH_FLAGS (c) >> 16) & 1)
-
-#define SYNTAX_COMSTART_SECOND(c) ((SYNTAX_WITH_FLAGS (c) >> 17) & 1)
-
-#define SYNTAX_COMEND_FIRST(c) ((SYNTAX_WITH_FLAGS (c) >> 18) & 1)
-
-#define SYNTAX_COMEND_SECOND(c) ((SYNTAX_WITH_FLAGS (c) >> 19) & 1)
-
-#define SYNTAX_PREFIX(c) ((SYNTAX_WITH_FLAGS (c) >> 20) & 1)
-
-#define SYNTAX_COMMENT_STYLE(c) ((SYNTAX_WITH_FLAGS (c) >> 21) & 1)
-
-#define SYNTAX_COMMENT_NESTED(c) ((SYNTAX_WITH_FLAGS (c) >> 22) & 1)
-
-/* These macros extract specific flags from an integer
-   that holds the syntax code and the flags.  */
-
-#define SYNTAX_FLAGS_COMSTART_FIRST(flags) (((flags) >> 16) & 1)
-
-#define SYNTAX_FLAGS_COMSTART_SECOND(flags) (((flags) >> 17) & 1)
-
-#define SYNTAX_FLAGS_COMEND_FIRST(flags) (((flags) >> 18) & 1)
-
-#define SYNTAX_FLAGS_COMEND_SECOND(flags) (((flags) >> 19) & 1)
-
-#define SYNTAX_FLAGS_PREFIX(flags) (((flags) >> 20) & 1)
-
-#define SYNTAX_FLAGS_COMMENT_STYLE(flags) (((flags) >> 21) & 1)
-
-#define SYNTAX_FLAGS_COMMENT_NESTED(flags) (((flags) >> 22) & 1)
+/* Whether the syntax of the character C has the prefix flag set.  */
+extern int syntax_prefix_flag_p (int c);
 
 /* This array, indexed by a character, contains the syntax code which that
  character signifies (as a char).  For example,
--- a/src/unexcoff.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/unexcoff.c	Sun Aug 15 22:50:44 2010 +0000
@@ -74,12 +74,8 @@
  * of Dell Computer Corporation.  james@bigtex.cactus.org.
  */
 
-#ifndef emacs
-#define PERROR(arg) perror (arg); return -1
-#else
 #include <config.h>
 #define PERROR(file) report_error (file, new)
-#endif
 
 #ifndef CANNOT_DUMP  /* all rest of file!  */
 
@@ -132,7 +128,6 @@
 #endif
 
 
-extern char *start_of_text ();		/* Start of text */
 extern char *start_of_data ();		/* Start of initialized data */
 
 static long block_copy_start;		/* Old executable start point */
@@ -155,8 +150,6 @@
 
 #define ADDR_CORRECT(x) ((char *)(x) - (char*)0)
 
-#ifdef emacs
-
 #include <setjmp.h>
 #include "lisp.h"
 
@@ -169,7 +162,6 @@
     close (fd);
   report_file_error ("Cannot unexec", Fcons (build_string (file), Qnil));
 }
-#endif /* emacs */
 
 #define ERROR0(msg) report_error_1 (new, msg, 0, 0); return -1
 #define ERROR1(msg,x) report_error_1 (new, msg, x, 0); return -1
@@ -182,12 +174,7 @@
      int a1, a2;
 {
   close (fd);
-#ifdef emacs
   error (msg, a1, a2);
-#else
-  fprintf (stderr, msg, a1, a2);
-  fprintf (stderr, "\n");
-#endif
 }
 
 static int make_hdr ();
@@ -319,9 +306,6 @@
      to correspond to what we want to dump.  */
 
   f_hdr.f_flags |= (F_RELFLG | F_EXEC);
-  f_ohdr.text_start = (long) start_of_text ();
-  f_ohdr.tsize = data_start - f_ohdr.text_start;
-  f_ohdr.data_start = data_start;
   f_ohdr.dsize = bss_start - f_ohdr.data_start;
   f_ohdr.bsize = bss_end - bss_start;
   f_thdr.s_size = f_ohdr.tsize;
@@ -417,16 +401,6 @@
 	    nwrite = pagesize;
 	  write (new, zeros, nwrite);
 	}
-#if 0 /* Now that we have can ask `write' to write more than a page,
-	 it is legit for write do less than the whole amount specified.  */
-      else if (nwrite != ret)
-	{
-	  sprintf (buf,
-		   "unexec write failure: addr 0x%x, fileno %d, size 0x%x, wrote 0x%x, errno %d",
-		   ptr, new, nwrite, ret, errno);
-	  PERROR (buf);
-	}
-#endif
       i += nwrite;
       ptr += nwrite;
     }
@@ -606,21 +580,6 @@
   return 0;
 }
 
-extern unsigned start __asm__ ("start");
-
-/*
- *	Return the address of the start of the text segment prior to
- *	doing an unexec.  After unexec the return value is undefined.
- *	See crt0.c for further explanation and _start.
- *
- */
-
-char *
-start_of_text (void)
-{
-  return ((char *) &start);
-}
-
 /* ****************************************************************
  * unexec
  *
--- a/src/unexmacosx.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/unexmacosx.c	Sun Aug 15 22:50:44 2010 +0000
@@ -267,7 +267,7 @@
 /* Debugging and informational messages routines.  */
 
 static void
-unexec_error (char *format, ...)
+unexec_error (const char *format, ...)
 {
   va_list ap;
 
--- a/src/w16select.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/w16select.c	Sun Aug 15 22:50:44 2010 +0000
@@ -456,7 +456,7 @@
   (Lisp_Object string, Lisp_Object frame)
 {
   unsigned ok = 1, put_status = 0;
-  int nbytes, charset_info, no_crlf_conversion;
+  int nbytes, no_crlf_conversion;
   unsigned char *src, *dst = NULL;
 
   CHECK_STRING (string);
@@ -494,9 +494,7 @@
     {
       /* We must encode contents of STRING according to what
 	 clipboard-coding-system specifies.  */
-      int bufsize;
       struct coding_system coding;
-      unsigned char *htext2;
       Lisp_Object coding_system =
 	NILP (Vnext_selection_coding_system) ?
 	Vselection_coding_system : Vnext_selection_coding_system;
@@ -567,7 +565,7 @@
   unsigned data_size, truelen;
   unsigned char *htext = NULL;
   Lisp_Object ret = Qnil;
-  int no_crlf_conversion, require_decoding = 0;
+  int require_decoding = 0;
 
   if (NILP (frame))
     frame = Fselected_frame ();
@@ -608,8 +606,6 @@
   }
   if (require_decoding)
     {
-      int bufsize;
-      unsigned char *buf;
       struct coding_system coding;
       Lisp_Object coding_system = Vnext_selection_coding_system;
 
--- a/src/w32menu.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/w32menu.c	Sun Aug 15 22:50:44 2010 +0000
@@ -72,10 +72,16 @@
     IN UINT,
     IN BOOL,
     IN LPCMENUITEMINFOA);
+typedef int (WINAPI * MessageBoxW_Proc) (
+    IN HWND window,
+    IN WCHAR *text,
+    IN WCHAR *caption,
+    IN UINT type);
 
 GetMenuItemInfoA_Proc get_menu_item_info = NULL;
 SetMenuItemInfoA_Proc set_menu_item_info = NULL;
 AppendMenuW_Proc unicode_append_menu = NULL;
+MessageBoxW_Proc unicode_message_box = NULL;
 
 Lisp_Object Qdebug_on_next_call;
 
@@ -99,6 +105,8 @@
 static Lisp_Object simple_dialog_show (FRAME_PTR, Lisp_Object, Lisp_Object);
 #endif
 
+static void utf8to16 (unsigned char *, int, WCHAR *);
+
 void w32_free_menu_strings (HWND);
 
 
@@ -662,7 +670,7 @@
 
 Lisp_Object
 w32_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
-	       Lisp_Object title, char **error)
+	       Lisp_Object title, const char **error)
 {
   int i;
   int menu_item_selection;
@@ -1220,30 +1228,73 @@
 {
   int answer;
   UINT type;
-  char *text, *title;
   Lisp_Object lispy_answer = Qnil, temp = XCAR (contents);
 
-  if (STRINGP (temp))
-    text = SDATA (temp);
-  else
-    text = "";
-
-  if (NILP (header))
-    {
-      title = "Question";
-      type = MB_ICONQUESTION;
-    }
-  else
-    {
-      title = "Information";
-      type = MB_ICONINFORMATION;
-    }
-  type |= MB_YESNO;
+  type = MB_YESNO;
 
   /* Since we only handle Yes/No dialogs, and we already checked
      is_simple_dialog, we don't need to worry about checking contents
      to see what type of dialog to use.  */
-  answer = MessageBox (FRAME_W32_WINDOW (f), text, title, type);
+
+  /* Use unicode if possible, so any language can be displayed.  */
+  if (unicode_message_box)
+    {
+      WCHAR *text, *title;
+
+      if (STRINGP (temp))
+	{
+	  char *utf8_text = SDATA (ENCODE_UTF_8 (temp));
+	  /* Be pessimistic about the number of characters needed.
+	     Remember characters outside the BMP will take more than
+	     one utf16 word, so we cannot simply use the character
+	     length of temp.  */
+	  int utf8_len = strlen (utf8_text);
+	  text = alloca ((utf8_len + 1) * sizeof (WCHAR));
+	  utf8to16 (utf8_text, utf8_len, text);
+	}
+      else
+	{
+	  text = L"";
+	}
+
+      if (NILP (header))
+	{
+	  title = L"Question";
+	  type |= MB_ICONQUESTION;
+	}
+      else
+	{
+	  title = L"Information";
+	  type |= MB_ICONINFORMATION;
+	}
+
+      answer = unicode_message_box (FRAME_W32_WINDOW (f), text, title, type);
+    }
+  else
+    {
+      char *text, *title;
+
+      /* Fall back on ANSI message box, but at least use system
+	 encoding so questions representable by the system codepage
+	 are encoded properly.  */
+      if (STRINGP (temp))
+	text = SDATA (ENCODE_SYSTEM (temp));
+      else
+	text = "";
+
+      if (NILP (header))
+	{
+	  title = "Question";
+	  type |= MB_ICONQUESTION;
+	}
+      else
+	{
+	  title = "Information";
+	  type |= MB_ICONINFORMATION;
+	}
+
+      answer = MessageBox (FRAME_W32_WINDOW (f), text, title, type);
+    }
 
   if (answer == IDYES)
     lispy_answer = build_string ("Yes");
@@ -1280,9 +1331,9 @@
 
 /* Is this item a separator? */
 static int
-name_is_separator (char *name)
+name_is_separator (const char *name)
 {
-  char *start = name;
+  const char *start = name;
 
   /* Check if name string consists of only dashes ('-').  */
   while (*name == '-') name++;
@@ -1360,7 +1411,7 @@
 	  strcat (out_string, wv->key);
 	}
       else
-	out_string = wv->name;
+	out_string = (char *)wv->name;
 
       /* Quote any special characters within the menu item's text and
 	 key binding.  */
@@ -1697,6 +1748,7 @@
   get_menu_item_info = (GetMenuItemInfoA_Proc) GetProcAddress (user32, "GetMenuItemInfoA");
   set_menu_item_info = (SetMenuItemInfoA_Proc) GetProcAddress (user32, "SetMenuItemInfoA");
   unicode_append_menu = (AppendMenuW_Proc) GetProcAddress (user32, "AppendMenuW");
+  unicode_message_box = (MessageBoxW_Proc) GetProcAddress (user32, "MessageBoxW");
 }
 
 /* arch-tag: 0eaed431-bb4e-4aac-a527-95a1b4f1fed0
--- a/src/w32term.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/w32term.c	Sun Aug 15 22:50:44 2010 +0000
@@ -2106,17 +2106,34 @@
   if (s->hl == DRAW_CURSOR
       && !x_stretch_cursor_p)
     {
-      /* If `x-stretch-block-cursor' is nil, don't draw a block cursor
-	 as wide as the stretch glyph.  */
+      /* If `x-stretch-cursor' is nil, don't draw a block cursor as
+	 wide as the stretch glyph.  */
       int width, background_width = s->background_width;
-      int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
-
-      if (x < left_x)
+      int x = s->x;
+
+      if (!s->row->reversed_p)
 	{
-	  background_width -= left_x - x;
-	  x = left_x;
+	  int left_x = window_box_left_offset (s->w, TEXT_AREA);
+
+	  if (x < left_x)
+	    {
+	      background_width -= left_x - x;
+	      x = left_x;
+	    }
+	}
+      else
+	{
+	  /* In R2L rows, draw the cursor on the right edge of the
+	     stretch glyph.  */
+	  int right_x = window_box_right_offset (s->w, TEXT_AREA);
+
+	  if (x + background_width > right_x)
+	    background_width -= x - right_x;
+	  x += background_width;
 	}
       width = min (FRAME_COLUMN_WIDTH (s->f), background_width);
+      if (s->row->reversed_p)
+	x -= width;
 
       /* Draw cursor.  */
       x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height);
@@ -2130,7 +2147,10 @@
 	  RECT r;
           HDC hdc = s->hdc;
 
-	  x += width;
+	  if (!s->row->reversed_p)
+	    x += width;
+	  else
+	    x = s->x;
 	  if (s->row->mouse_face_p
 	      && cursor_in_mouse_face_p (s->w))
 	    {
--- a/src/xdisp.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/xdisp.c	Sun Aug 15 22:50:44 2010 +0000
@@ -1208,7 +1208,7 @@
 
 
 /* Return the window-relative coordinate of the right edge of display
-   area AREA of window W.  AREA < 0 means return the left edge of the
+   area AREA of window W.  AREA < 0 means return the right edge of the
    whole window, to the left of the right fringe of W.  */
 
 INLINE int
@@ -1238,7 +1238,7 @@
 
 
 /* Return the frame-relative coordinate of the right edge of display
-   area AREA of window W.  AREA < 0 means return the left edge of the
+   area AREA of window W.  AREA < 0 means return the right edge of the
    whole window, to the left of the right fringe of W.  */
 
 INLINE int
@@ -17962,16 +17962,22 @@
       struct bidi_it itb;
       EMACS_INT pos = BUF_PT (buf);
       EMACS_INT bytepos = BUF_PT_BYTE (buf);
+      int c;
 
       if (buf != current_buffer)
 	set_buffer_temp (buf);
-      /* Find previous non-empty line.  */
+      /* bidi_paragraph_init finds the base direction of the paragraph
+	 by searching forward from paragraph start.  We need the base
+	 direction of the current or _previous_ paragraph, so we need
+	 to make sure we are within that paragraph.  To that end, find
+	 the previous non-empty line.  */
       if (pos >= ZV && pos > BEGV)
 	{
 	  pos--;
 	  bytepos = CHAR_TO_BYTE (pos);
 	}
-      while (FETCH_BYTE (bytepos) == '\n')
+      while ((c = FETCH_BYTE (bytepos)) == '\n'
+	     || c == ' ' || c == '\t' || c == '\f')
 	{
 	  if (bytepos <= BEGV_BYTE)
 	    break;
@@ -17983,6 +17989,7 @@
       itb.charpos = pos;
       itb.bytepos = bytepos;
       itb.first_elt = 1;
+      itb.separator_limit = -1;
 
       bidi_paragraph_init (NEUTRAL_DIR, &itb);
       if (buf != current_buffer)
--- a/src/xfns.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/xfns.c	Sun Aug 15 22:50:44 2010 +0000
@@ -648,12 +648,16 @@
 x_defined_color (struct frame *f, const char *color_name,
 		 XColor *color, int alloc_p)
 {
-  int success_p;
+  int success_p = 0;
   Display *dpy = FRAME_X_DISPLAY (f);
   Colormap cmap = FRAME_X_COLORMAP (f);
 
   BLOCK_INPUT;
-  success_p = XParseColor (dpy, cmap, color_name, color);
+#ifdef USE_GTK
+  success_p = xg_check_special_colors (f, color_name, color);
+#endif
+  if (!success_p)
+    success_p = XParseColor (dpy, cmap, color_name, color);
   if (success_p && alloc_p)
     success_p = x_alloc_nearest_color (f, cmap, color);
   UNBLOCK_INPUT;
@@ -3388,6 +3392,8 @@
 		       "waitForWM", "WaitForWM", RES_TYPE_BOOLEAN);
   x_default_parameter (f, parms, Qfullscreen, Qnil,
                        "fullscreen", "Fullscreen", RES_TYPE_SYMBOL);
+  x_default_parameter (f, parms, Qtool_bar_position,
+                       f->tool_bar_position, 0, 0, RES_TYPE_SYMBOL);
 
   /* Compute the size of the X window.  */
   window_prompting = x_figure_window_size (f, parms, 1);
@@ -5233,7 +5239,7 @@
   /* When using system tooltip, tip_frame is the Emacs frame on which
      the tip is shown.  */
   f = XFRAME (frame);
-  if (xg_hide_tooltip (f))
+  if (FRAME_LIVE_P (f) && xg_hide_tooltip (f))
     frame = Qnil;
 #endif
 
--- a/src/xmenu.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/xmenu.c	Sun Aug 15 22:50:44 2010 +0000
@@ -111,7 +111,7 @@
 
 #if defined (USE_X_TOOLKIT) || defined (USE_GTK)
 static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object,
-                                 char **);
+                                 const char **);
 #endif
 
 static int update_frame_menubar (struct frame *);
@@ -312,7 +312,7 @@
 #else
   {
     Lisp_Object title;
-    char *error_name;
+    const char *error_name;
     Lisp_Object selection;
     int specpdl_count = SPECPDL_INDEX ();
 
@@ -1600,7 +1600,7 @@
 
 Lisp_Object
 xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
-	    Lisp_Object title, char **error, EMACS_UINT timestamp)
+	    Lisp_Object title, const char **error, EMACS_UINT timestamp)
 {
   int i;
   widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0;
@@ -1664,7 +1664,7 @@
 	{
 	  /* Create a new pane.  */
 	  Lisp_Object pane_name, prefix;
-	  char *pane_string;
+	  const char *pane_string;
 
 	  pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
 	  prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
@@ -1976,12 +1976,16 @@
 
 #endif /* not USE_GTK */
 
-static char * button_names [] = {
+static const char * button_names [] = {
   "button1", "button2", "button3", "button4", "button5",
   "button6", "button7", "button8", "button9", "button10" };
 
 static Lisp_Object
-xdialog_show (FRAME_PTR f, int keymaps, Lisp_Object title, Lisp_Object header, char **error_name)
+xdialog_show (FRAME_PTR f,
+              int keymaps,
+              Lisp_Object title,
+              Lisp_Object header,
+              const char **error_name)
 {
   int i, nb_buttons=0;
   char dialog_name[6];
@@ -2008,7 +2012,7 @@
      representing the text label and buttons.  */
   {
     Lisp_Object pane_name, prefix;
-    char *pane_string;
+    const char *pane_string;
     pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME];
     prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX];
     pane_string = (NILP (pane_name)
@@ -2239,7 +2243,7 @@
 
 Lisp_Object
 xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
-	    Lisp_Object title, char **error, EMACS_UINT timestamp)
+	    Lisp_Object title, const char **error, EMACS_UINT timestamp)
 {
   Window root;
   XMenu *menu;
--- a/src/xrdb.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/xrdb.c	Sun Aug 15 22:50:44 2010 +0000
@@ -334,16 +334,17 @@
 get_system_app (const char *class)
 {
   XrmDatabase db = NULL;
-  char *path;
+  const char *path;
+  char *p;
 
   path = getenv ("XFILESEARCHPATH");
   if (! path) path = PATH_X_DEFAULTS;
 
-  path = search_magic_path (path, class, 0, 0);
-  if (path)
+  p = search_magic_path (path, class, 0, 0);
+  if (p)
     {
-      db = XrmGetFileDatabase (path);
-      xfree (path);
+      db = XrmGetFileDatabase (p);
+      xfree (p);
     }
 
   return db;
@@ -360,7 +361,7 @@
 static XrmDatabase
 get_user_app (const char *class)
 {
-  char *path;
+  const char *path;
   char *file = 0;
   char *free_it = 0;
 
--- a/src/xselect.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/xselect.c	Sun Aug 15 22:50:44 2010 +0000
@@ -2596,6 +2596,7 @@
 {
   struct frame *f = check_x_frame (frame);
   char *name = 0;
+  char empty[] = "";
   Lisp_Object ret = Qnil;
   Display *dpy = FRAME_X_DISPLAY (f);
   Atom atom;
@@ -2612,7 +2613,7 @@
 
   BLOCK_INPUT;
   x_catch_errors (dpy);
-  name = atom ? XGetAtomName (dpy, atom) : "";
+  name = atom ? XGetAtomName (dpy, atom) : empty;
   had_errors = x_had_errors_p (dpy);
   x_uncatch_errors ();
 
--- a/src/xsmfns.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/xsmfns.c	Sun Aug 15 22:50:44 2010 +0000
@@ -87,7 +87,7 @@
 /* The option to start Emacs without the splash screen when
    restarting Emacs.  */
 
-#define NOSPLASH_OPT "--no-splash"
+static char NOSPLASH_OPT[] = "--no-splash";
 
 /* The option to make Emacs start in the given directory.  */
 
@@ -198,14 +198,14 @@
   SmPropValue values[20];
   int val_idx = 0;
   int props_idx = 0;
-
+  int i;
   char *cwd = NULL;
   char *smid_opt, *chdir_opt = NULL;
 
   /* How to start a new instance of Emacs.  */
   props[props_idx] = &prop_ptr[props_idx];
-  props[props_idx]->name = SmCloneCommand;
-  props[props_idx]->type = SmLISTofARRAY8;
+  props[props_idx]->name = xstrdup (SmCloneCommand);
+  props[props_idx]->type = xstrdup (SmLISTofARRAY8);
   props[props_idx]->num_vals = 1;
   props[props_idx]->vals = &values[val_idx++];
   props[props_idx]->vals[0].length = strlen (emacs_program);
@@ -214,8 +214,8 @@
 
   /* The name of the program.  */
   props[props_idx] = &prop_ptr[props_idx];
-  props[props_idx]->name = SmProgram;
-  props[props_idx]->type = SmARRAY8;
+  props[props_idx]->name = xstrdup (SmProgram);
+  props[props_idx]->type = xstrdup (SmARRAY8);
   props[props_idx]->num_vals = 1;
   props[props_idx]->vals = &values[val_idx++];
   props[props_idx]->vals[0].length = strlen (SSDATA (Vinvocation_name));
@@ -224,8 +224,8 @@
 
   /* How to restart Emacs.  */
   props[props_idx] = &prop_ptr[props_idx];
-  props[props_idx]->name = SmRestartCommand;
-  props[props_idx]->type = SmLISTofARRAY8;
+  props[props_idx]->name = xstrdup (SmRestartCommand);
+  props[props_idx]->type = xstrdup (SmLISTofARRAY8);
   /* /path/to/emacs, --smid=xxx --no-splash --chdir=dir */
   props[props_idx]->num_vals = 4;
   props[props_idx]->vals = &values[val_idx];
@@ -258,8 +258,8 @@
 
   /* User id.  */
   props[props_idx] = &prop_ptr[props_idx];
-  props[props_idx]->name = SmUserID;
-  props[props_idx]->type = SmARRAY8;
+  props[props_idx]->name = xstrdup (SmUserID);
+  props[props_idx]->type = xstrdup (SmARRAY8);
   props[props_idx]->num_vals = 1;
   props[props_idx]->vals = &values[val_idx++];
   props[props_idx]->vals[0].length = strlen (SSDATA (Vuser_login_name));
@@ -270,8 +270,8 @@
   if (cwd)
     {
       props[props_idx] = &prop_ptr[props_idx];
-      props[props_idx]->name = SmCurrentDirectory;
-      props[props_idx]->type = SmARRAY8;
+      props[props_idx]->name = xstrdup (SmCurrentDirectory);
+      props[props_idx]->type = xstrdup (SmARRAY8);
       props[props_idx]->num_vals = 1;
       props[props_idx]->vals = &values[val_idx++];
       props[props_idx]->vals[0].length = strlen (cwd);
@@ -286,6 +286,11 @@
   xfree (chdir_opt);
 
   free (cwd);
+  for (i = 0; i < props_idx; ++i)
+    {
+      xfree (props[i]->type);
+      xfree (props[i]->name);
+    }
 
   /* See if we maybe shall interact with the user.  */
   if (interactStyle != SmInteractStyleAny
--- a/src/xterm.c	Wed Aug 11 03:20:07 2010 +0000
+++ b/src/xterm.c	Sun Aug 15 22:50:44 2010 +0000
@@ -301,6 +301,9 @@
 Lisp_Object Qx_gtk_map_stock;
 #endif
 
+/* Some functions take this as char *, not const char *.  */
+static char emacs_class[] = EMACS_CLASS;
+
 /* Used in x_flush.  */
 
 extern XrmDatabase x_load_resources (Display *, const char *, const char *,
@@ -2432,17 +2435,34 @@
   if (s->hl == DRAW_CURSOR
       && !x_stretch_cursor_p)
     {
-      /* If `x-stretch-block-cursor' is nil, don't draw a block cursor
-	 as wide as the stretch glyph.  */
+      /* If `x-stretch-cursor' is nil, don't draw a block cursor as
+	 wide as the stretch glyph.  */
       int width, background_width = s->background_width;
-      int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
-
-      if (x < left_x)
+      int x = s->x;
+
+      if (!s->row->reversed_p)
 	{
-	  background_width -= left_x - x;
-	  x = left_x;
+	  int left_x = window_box_left_offset (s->w, TEXT_AREA);
+
+	  if (x < left_x)
+	    {
+	      background_width -= left_x - x;
+	      x = left_x;
+	    }
+	}
+      else
+	{
+	  /* In R2L rows, draw the cursor on the right edge of the
+	     stretch glyph.  */
+	  int right_x = window_box_right_offset (s->w, TEXT_AREA);
+
+	  if (x + background_width > right_x)
+	    background_width -= x - right_x;
+	  x += background_width;
 	}
       width = min (FRAME_COLUMN_WIDTH (s->f), background_width);
+      if (s->row->reversed_p)
+	x -= width;
 
       /* Draw cursor.  */
       x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height);
@@ -2455,7 +2475,10 @@
 	  XRectangle r;
 	  GC gc;
 
-	  x += width;
+	  if (!s->row->reversed_p)
+	    x += width;
+	  else
+	    x = s->x;
 	  if (s->row->mouse_face_p
 	      && cursor_in_mouse_face_p (s->w))
 	    {
@@ -7872,7 +7895,7 @@
       if (dpyinfo->xim)
 	XCloseIM (dpyinfo->xim);
       xim = XOpenIM (dpyinfo->display, dpyinfo->xrdb, resource_name,
-		     EMACS_CLASS);
+		     emacs_class);
       dpyinfo->xim = xim;
 
       if (xim)
@@ -7973,7 +7996,7 @@
       xim_inst->resource_name = (char *) xmalloc (len + 1);
       memcpy (xim_inst->resource_name, resource_name, len + 1);
       XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb,
-				      resource_name, EMACS_CLASS,
+				      resource_name, emacs_class,
 				      xim_instantiate_callback,
 				      /* This is XPointer in XFree86
 					 but (XPointer *) on Tru64, at
@@ -7998,7 +8021,7 @@
 #ifdef HAVE_X11R6_XIM
       if (dpyinfo->display)
 	XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb,
-					  NULL, EMACS_CLASS,
+					  NULL, emacs_class,
 					  xim_instantiate_callback, NULL);
       xfree (dpyinfo->xim_callback_data->resource_name);
       xfree (dpyinfo->xim_callback_data);
@@ -9709,6 +9732,9 @@
       }
     else
       {
+        static char display_opt[] = "--display";
+        static char name_opt[] = "--name";
+        
         for (argc = 0; argc < NUM_ARGV; ++argc)
           argv[argc] = 0;
 
@@ -9717,11 +9743,11 @@
 
         if (! NILP (display_name))
           {
-            argv[argc++] = "--display";
+            argv[argc++] = display_opt;
             argv[argc++] = SDATA (display_name);
           }
 
-        argv[argc++] = "--name";
+        argv[argc++] = name_opt;
         argv[argc++] = resource_name;
 
         XSetLocaleModifiers ("");
@@ -9744,7 +9770,7 @@
 
         /* Load our own gtkrc if it exists.  */
         {
-          char *file = "~/.emacs.d/gtkrc";
+          const char *file = "~/.emacs.d/gtkrc";
           Lisp_Object s, abs_file;
 
           s = make_string (file, strlen (file));