]> code.delx.au - gnu-emacs/commitdiff
Merge from emacs--devo--0
authorMiles Bader <miles@gnu.org>
Sat, 20 Oct 2007 02:22:59 +0000 (02:22 +0000)
committerMiles Bader <miles@gnu.org>
Sat, 20 Oct 2007 02:22:59 +0000 (02:22 +0000)
Patches applied:

 * emacs--devo--0  (patch 899-900)

   - Update from CVS
   - Merge from emacs--rel--22

 * emacs--rel--22  (patch 129-130)

   - Update from CVS
   - Merge from gnus--rel--5.10

 * gnus--rel--5.10  (patch 259-260)

   - Merge from emacs--rel--22
   - Update from CVS

Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-272

1  2 
lisp/ChangeLog
lisp/bindings.el
lisp/diff-mode.el
lisp/help-fns.el
lisp/smerge-mode.el
src/Makefile.in
src/doc.c
src/process.c

diff --combined lisp/ChangeLog
index 4fe538b3bd4a2ba33c416b70b68781d39c3a7929,8ea68f0da04cad86b7a14ce2d29b73dad9a91f5d..ab50949e6391d5a320adc86506283d5ceaaa640e
 -      * diff-mode.el (diff-auto-refine): New var.
 -      (diff-hunk): Use it.
 -      (diff-ignore-whitespace-hunk): Rename diff-refine-ignore-spaces-hunk.
 -      (diff-refine-change): Rename from diff-fine-change.  Change it.
 -      (diff-refine-preproc): Rename from diff-fine-highlight-preproc.
 -      (diff-refine-hunk): Rename from diff-fine-highlight.
 -
 -2007-10-20  John Paul Wallington  <jpw@pobox.com>
 -
 -      * help-fns.el (describe-variable-custom-version-info): New function
 -      to return variable's version or package version note.
 -      (describe-variable): Use it, display result.
 -
 -2007-10-20  Stefan Monnier  <monnier@iro.umontreal.ca>
 -
 -      * smerge-mode.el (smerge-auto-refine): New var.
 -      (smerge-next, smerge-prev): Use it.
 -      (smerge-batch-resolve): Ad-hoc trick for Arch's .rej files.
 -
+ 2007-10-19  Juanma Barranquero  <lekktu@gmail.com>
+       * bs.el (bs--track-window-changes): Don't refresh the whole list.
+       (bs-mode): Set mode-class property to special.
+ 2007-10-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+       * emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
+       Add `body' arg.  Cleanup the check-narrow-maybe/re-narrow-maybe mess.
+       * vc-bzr.el (vc-bzr-diff-tree):
+       * vc-git.el (vc-git-diff-tree):
+       * vc-hg.el (vc-hg-diff-tree):
+       * vc-mcvs.el (vc-mcvs-diff-tree):
+       * vc-mtn.el (vc-mtn-diff-tree):
+       * vc-svn.el (vc-svn-diff-tree): Remove.
+       * vc-mtn.el (vc-mtn-revision-completion-table):
+       * vc-cvs.el (vc-cvs-revision-completion-table):
+       * vc-arch.el (vc-arch-revision-completion-table):
+       * vc-hg.el (vc-hg-revision-completion-table, vc-hg-revision-table):
+       * vc-git.el (vc-git-revision-completion-table, vc-git-revision-table):
+       Make it work when the arg is a list of files.
+ 2007-10-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+       * vc.el: Remove `diff-tree' operation, now subsumed by `diff'.
+       Also `revision-completion-table' now takes a list of files.
+       (vc-deduce-fileset): Remove unused var `regexp'.
+       Only obey allow-directory-wildcard in dired buffers.
+       (vc-default-diff-tree): Remove.
+       (vc-diff-added-files): New var.
+       (vc-diff-internal): Use it.  Remove arg `backend'.  Update callers.
+       (vc-version-diff): Revert from `vc-history-diff' to the original name.
+       Remove the `backend' arg.
+       (vc-contains-version-controlled-file): Remove.
+       (vc-diff): Bring it closer to the version in Emacs-22.
+       (vc-revert): Fix typo in let-binding.
+       (vc-default-unregister): Remove.
+       (vc-dired-buffers-for-dir): Remove N^2 behavior.
+ 2007-10-19  Dan Nicolaescu  <dann@ics.uci.edu>
+       * textmodes/two-column.el (2C-split, 2C-merge):
+       * textmodes/bib-mode.el (bib-find-key, mark-bib):
+       * progmodes/idlw-shell.el (idlwave-shell-move-or-history):
+       * progmodes/etags.el (find-tag-in-order, etags-tags-apropos)
+       * progmodes/ada-xref.el (ada-get-all-references):
+       * obsolete/mlsupport.el (ml-next-line, ml-previous-line):
+       * emulation/vi.el (vi-previous-line-first-nonwhite)
+       (vi-effective-range, vi-put-before):
+       * emulation/edt.el (edt-next-line, edt-previous-line)
+       (edt-paragraph-forward): Use forward-line.
+       * progmodes/etags.el (tags-apropos): Require apropos at compile
+       time too.
+       * progmodes/prolog.el: Require comint when compiling.
+       (inferior-prolog-flavor): Move defvar before use.
+ 2007-10-19  Richard Stallman  <rms@gnu.org>
+       * font-core.el (turn-on-font-lock-if-desired):
+       Rename from `turn-on-font-lock-if-enabled'.
+       Fully obey `font-lock-global-modes'.
+ 2007-10-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+       * diff-mode.el (diff-fine-highlight-preproc): Stick to minimal changes
+       which will not affect the behavior of things like forward-word.
+       (diff-fine-highlight): Preserve point.
+       * doc-view.el (doc-view-mode-map): Use remapping.
+       Don't rebind C-v, M-v to their default value.
+       Don't bind mouse-4 and mouse-5: it's mwheel.el's job.
+       * smerge-mode.el: Add word-granularity refinement.
+       (smerge-refine-forward-function, smerge-refine-ignore-whitespace)
+       (smerge-refine-weight-hack): New vars.
+       (smerge-refine-forward): New fun.
+       (smerge-refine-chopup-region, smerge-refine-highlight-change): Use them.
+       (smerge-refine-subst): Use them as well.  Preserve point.
+ 2007-10-19  Juanma Barranquero  <lekktu@gmail.com>
+       * follow.el (follow-unload-function): New function.
+       * loadhist.el (unload-function-features-list):
+       Rename from `unload-hook-features-list'.
+       (unload-hook-features-list): Add as obsolete alias.
+       (unload-feature): Use `unload-function-features-list'
+       and new FEATURE-unload-function.
+ 2007-10-19  Glenn Morris  <rgm@gnu.org>
+       * bindings.el (mouse-minor-mode-menu)
+       (minor-mode-menu-from-indicator): Move to mouse.el.
+       * mouse.el (mouse-minor-mode-menu, minor-mode-menu-from-indicator):
+       Move here from bindings.el.
+ 2007-10-19  Richard Stallman  <rms@gnu.org>
+       * help-fns.el (describe-function-1): Don't use the advice origname
+       if it has no function definition.
  2007-10-18  Johan Bockg\e,Ae\e(Brd  <bojohan@gnu.org>
  
        * net/tramp.el (tramp-rfn-eshadow-update-overlay): Save excursion.
        * doc-view.el (doc-view-dvi->pdf-sentinel, doc-view-dvi->pdf)
        (doc-view-pdf/ps->png-sentinel, doc-view-pdf/ps->png)
        (doc-view-pdf->txt-sentinel, doc-view-pdf->txt)
-       (doc-view-ps->pdf-sentinel, doc-view-ps->pdf): Remove superfluous
-       messages.
-       (doc-view-mode-map): Use the image-mode scrolling commands.  Don't
-       rebind C-x k.
+       (doc-view-ps->pdf-sentinel, doc-view-ps->pdf):
+       Remove superfluous messages.
+       (doc-view-mode-map): Use the image-mode scrolling commands.
+       Don't rebind C-x k.
  
  2007-10-18  Reiner Steib  <Reiner.Steib@gmx.de>
  
        (suspend-tty-functions, resume-tty-functions): Install extra hooks
        for multi-tty.
  
 +2007-10-10  Vinicius Jose Latorre  <viniciusjl@ig.com.br>
 +
 +      * ps-print.el: Fix the usage of :foreground and :background face
 +      attributes.  Reported by Nikolaj Schumacher <n_schumacher@web.de>.
 +      (ps-print-version): New version 7.2.5.
 +      (ps-face-attributes, ps-face-attribute-list, ps-face-background): Fix
 +      code.
 +      (ps-face-foreground-color-p, ps-face-background-color-p)
 +      (ps-face-color-p): New inline funs.
 +      (ps-background, ps-begin-file, ps-build-reference-face-lists): Use
 +      `mapc' rather than `mapcar'.
 +
 +
  2007-08-29  Stefan Monnier  <monnier@iro.umontreal.ca>
  
        * simple.el (invisible-p): Remove: implemented in C now.
diff --combined lisp/bindings.el
index 19819c15d6005dc7f2608648d40836a4de14bb00,52d7a6f6a5948b5371b0ed676fd00c036141004e..1bc31e04bb9fe231f9c31b23596cfcd3d37a4d6e
@@@ -493,26 -493,6 +493,6 @@@ Menu of mode operations in the mode lin
    (interactive "@e")
    (x-popup-menu event mode-line-mode-menu))
  
- (defun mouse-minor-mode-menu (event)
-   "Show minor-mode menu for EVENT on minor modes area of the mode line."
-   (interactive "@e")
-   (let ((indicator (car (nth 4 (car (cdr event))))))
-     (minor-mode-menu-from-indicator indicator)))
- (defun minor-mode-menu-from-indicator (indicator)
-   "Show menu, if any, for minor mode specified by INDICATOR.
- Interactively, INDICATOR is read using completion."
-   (interactive (list (completing-read "Minor mode indicator: "
-                                       (describe-minor-mode-completion-table-for-indicator))))
-   (let ((minor-mode (lookup-minor-mode-from-indicator indicator)))
-     (if minor-mode
-         (let* ((map (cdr-safe (assq minor-mode minor-mode-map-alist)))
-                (menu (and (keymapp map) (lookup-key map [menu-bar]))))
-           (if menu
-               (popup-menu menu)
-             (message "No menu for minor mode `%s'" minor-mode)))
-       (error "Cannot find minor mode for `%s'" indicator))))
  (defun mode-line-minor-mode-help (event)
    "Describe minor mode for EVENT on minor modes area of the mode line."
    (interactive "@e")
@@@ -643,6 -623,12 +623,6 @@@ language you are using.
  ;; that we will not need to keep permanently.
  (garbage-collect)
  \f
 -;; Make all multibyte characters self-insert.
 -(let ((l (generic-character-list))
 -      (table (nth 1 global-map)))
 -  (while l
 -    (aset table (car l) 'self-insert-command)
 -    (setq l (cdr l))))
  
  (setq help-event-list '(help f1))
  
diff --combined lisp/diff-mode.el
index 894a12b11937b5fd05ee13fd102f5d85a5678f8e,0208660c1a9618cb15aa89364acbc41f1bf88b09..972e7972e750649f1491eb8c47a32cbb5d91c227
@@@ -90,6 -90,9 +90,6 @@@ when editing big diffs).
    :type 'boolean
    :group 'diff-mode)
  
 -(defcustom diff-auto-refine t
 -  "Automatically highlight changes in detail as the user visits hunks."
 -  :type 'boolean)
  
  (defcustom diff-mode-hook nil
    "Run after setting up the `diff-mode' major mode."
      ("\C-c\C-a" . diff-apply-hunk)
      ("\C-c\C-e" . diff-ediff-patch)
      ("\C-c\C-n" . diff-restrict-view)
 +    ("\C-c\C-r" . diff-reverse-direction)
      ("\C-c\C-s" . diff-split-hunk)
      ("\C-c\C-t" . diff-test-hunk)
 -    ("\C-c\C-r" . diff-reverse-direction)
      ("\C-c\C-u" . diff-context->unified)
      ;; `d' because it duplicates the context :-(  --Stef
      ("\C-c\C-d" . diff-unified->context)
 -    ("\C-c\C-w" . diff-ignore-whitespace-hunk)
 -    ("\C-c\C-b" . diff-refine-hunk)  ;No reason for `b' :-(
 +    ("\C-c\C-w" . diff-refine-ignore-spaces-hunk)
 +    ("\C-c\C-b" . diff-fine-highlight)  ;No reason for `b' :-(
      ("\C-c\C-f" . next-error-follow-minor-mode))
    "Keymap for `diff-mode'.  See also `diff-mode-shared-map'.")
  
      ;;["Fixup Headers"                diff-fixup-modifs       (not buffer-read-only)]
      "-----"
      ["Split hunk"             diff-split-hunk         (diff-splittable-p)]
 -    ["Ignore whitespace changes" diff-ignore-whitespace-hunk t]
 -    ["Highlight fine changes" diff-refine-hunk        t]
 +    ["Ignore whitespace changes" diff-refine-ignore-spaces-hunk t]
 +    ["Highlight fine changes" diff-fine-highlight     t]
      ["Kill current hunk"      diff-hunk-kill          t]
      ["Kill current file's hunks" diff-file-kill       t]
      "-----"
@@@ -458,7 -461,10 +458,7 @@@ but in the file header instead, in whic
  
  ;; Define diff-{hunk,file}-{prev,next}
  (easy-mmode-define-navigation
 - diff-hunk diff-hunk-header-re "hunk" diff-end-of-hunk diff-restrict-view
 - (if diff-auto-refine
 -     (condition-case-no-debug nil (diff-refine-hunk) (error nil))))
 -
 + diff-hunk diff-hunk-header-re "hunk" diff-end-of-hunk diff-restrict-view)
  (easy-mmode-define-navigation
   diff-file diff-file-header-re "file" diff-end-of-hunk)
  
@@@ -1604,8 -1610,8 +1604,8 @@@ For use in `add-log-current-defun-funct
            (goto-char (+ (car pos) (cdr src)))
            (add-log-current-defun))))))
  
 -(defun diff-ignore-whitespace-hunk ()
 -  "Re-diff the current hunk, ignoring whitespace differences."
 +(defun diff-refine-ignore-spaces-hunk ()
 +  "Refine the current hunk by ignoring space differences."
    (interactive)
    (let* ((char-offset (- (point) (progn (diff-beginning-of-hunk 'try-harder)
                                          (point))))
  
  ;;; Fine change highlighting.
  
 -(defface diff-refine-change
 -  '((((class color) (min-colors 88) (background light))
 -     :background "grey90")
 -    (((class color) (min-colors 88) (background dark))
 -     :background "grey40")
 -    (((class color) (background light))
 -     :background "yellow")
 -    (((class color) (background dark))
 -     :background "green")
 -    (t :weight bold))
 -  "Face used for char-based changes shown by `diff-refine-hunk'."
 +(defface diff-fine-change
 +  '((t :background "yellow"))
 +  "Face used for char-based changes shown by `diff-fine-highlight'."
    :group 'diff-mode)
  
 -(defun diff-refine-preproc ()
 +(defun diff-fine-highlight-preproc ()
-   (while (re-search-forward "^." nil t)
-     ;; Replace the hunk's leading prefix (+, -, !, <, or >) on each line
-     ;; with something  constant, otherwise it'll be flagged as changes
-     ;; (since it's typically "-" on one side and "+" on the other).
-     ;; Note that we keep the same number of chars: we treat the prefix
-     ;; as part of the texts-to-diff, so that finding the right char
-     ;; afterwards will be easier.  This only makes sense because we make
-     ;; diffs at char-granularity.
-     (replace-match " ")))
+   (while (re-search-forward "^[+>]" nil t)
+     ;; Remove spurious changes due to the fact that one side of the hunk is
+     ;; marked with leading + or > and the other with leading - or <.
+     ;; We used to replace all the prefix chars with " " but this only worked
+     ;; when we did char-based refinement (or when using
+     ;; smerge-refine-weight-hack) since otherwise, the `forward' motion done
+     ;; in chopup do not necessarily do the same as the ones in highlight
+     ;; since the "_" is not treated the same as " ".
+     (replace-match (cdr (assq (char-before) '((?+ . "-") (?> . "<"))))))
+   )
  
 -(defun diff-refine-hunk ()
 +(defun diff-fine-highlight ()
    "Highlight changes of hunk at point at a finer granularity."
    (interactive)
    (require 'smerge-mode)
-   (diff-beginning-of-hunk 'try-harder)
-   (let* ((style (diff-hunk-style))      ;Skips the hunk header as well.
-          (beg (point))
-          (props '((diff-mode . fine) (face diff-fine-change)))
-          (end (progn (diff-end-of-hunk) (point))))
-     (remove-overlays beg end 'diff-mode 'fine)
-     (goto-char beg)
-     (case style
-      (unified
-       (while (re-search-forward "^\\(?:-.*\n\\)+\\(\\)\\(?:\\+.*\n\\)+" end t)
-         (smerge-refine-subst (match-beginning 0) (match-end 1)
-                              (match-end 1) (match-end 0)
-                              props 'diff-fine-highlight-preproc)))
-      (context
-       (let* ((middle (save-excursion (re-search-forward "^---")))
-              (other middle))
-         (while (re-search-forward "^\\(?:!.*\n\\)+" middle t)
-           (smerge-refine-subst (match-beginning 0) (match-end 0)
-                                (save-excursion
-                                  (goto-char other)
-                                  (re-search-forward "^\\(?:!.*\n\\)+" end)
-                                  (setq other (match-end 0))
-                                  (match-beginning 0))
-                                other
-                                props 'diff-fine-highlight-preproc))))
-      (t ;; Normal diffs.
-       (let ((beg1 (1+ (point))))
-         (when (re-search-forward "^---.*\n" end t)
-           ;; It's a combined add&remove, so there's something to do.
-           (smerge-refine-subst beg1 (match-beginning 0)
-                                (match-end 0) end
-                                props 'diff-fine-highlight-preproc)))))))
+   (save-excursion
+     (diff-beginning-of-hunk 'try-harder)
+     (let* ((style (diff-hunk-style))    ;Skips the hunk header as well.
+            (beg (point))
 -           (props '((diff-mode . fine) (face diff-refine-change)))
++           (props '((diff-mode . fine) (face diff-fine-change)))
+            (end (progn (diff-end-of-hunk) (point))))
+       (remove-overlays beg end 'diff-mode 'fine)
+       (goto-char beg)
+       (case style
+         (unified
+          (while (re-search-forward "^\\(?:-.*\n\\)+\\(\\)\\(?:\\+.*\n\\)+"
+                                    end t)
+            (smerge-refine-subst (match-beginning 0) (match-end 1)
+                                 (match-end 1) (match-end 0)
 -                                props 'diff-refine-preproc)))
++                                props 'diff-fine-highlight-preproc)))
+         (context
+          (let* ((middle (save-excursion (re-search-forward "^---")))
+                 (other middle))
+            (while (re-search-forward "^\\(?:!.*\n\\)+" middle t)
+              (smerge-refine-subst (match-beginning 0) (match-end 0)
+                                   (save-excursion
+                                     (goto-char other)
+                                     (re-search-forward "^\\(?:!.*\n\\)+" end)
+                                     (setq other (match-end 0))
+                                     (match-beginning 0))
+                                   other
 -                                  props 'diff-refine-preproc))))
++                                  props 'diff-fine-highlight-preproc))))
+         (t ;; Normal diffs.
+          (let ((beg1 (1+ (point))))
+            (when (re-search-forward "^---.*\n" end t)
+              ;; It's a combined add&remove, so there's something to do.
+              (smerge-refine-subst beg1 (match-beginning 0)
+                                   (match-end 0) end
 -                                  props 'diff-refine-preproc))))))))
++                                  props 'diff-fine-highlight-preproc))))))))
  
  
  ;; provide the package
diff --combined lisp/help-fns.el
index befd83c76ef32b4a4028d4609bac1ea7457af6c8,bf57824dcf0faaa68a47a9ec0fd778ea3f101600..f62fadc22b53b571042a04ab228c2fdf2f8a4abb
@@@ -252,11 -252,14 +252,14 @@@ face (according to `face-differs-from-d
  ;;;###autoload
  (defun describe-function-1 (function)
    (let* ((advised (and (featurep 'advice) (ad-get-advice-info function)))
-        ;; If the function is advised, get the symbol that has the
-        ;; real definition.
+        ;; If the function is advised, use the symbol that has the
+        ;; real definition, if that symbol is already set up.
         (real-function
-         (if advised (cdr (assq 'origname advised))
-           function))
+         (or (and advised
+                  (cdr (assq 'origname advised))
+                  (fboundp (cdr (assq 'origname advised)))
+                  (cdr (assq 'origname advised)))
+             function))
         ;; Get the real definition.
         (def (if (symbolp real-function)
                  (symbol-function real-function)
@@@ -453,6 -456,28 +456,6 @@@ If ANY-SYMBOL is non-nil, don't insist 
              (and (or any-symbol (boundp sym)) sym)))))
        0))
  
 -(defun describe-variable-custom-version-info (variable)
 -  (let ((custom-version (get variable 'custom-version))
 -      (cpv (get variable 'custom-package-version))
 -      (output nil))
 -    (if custom-version
 -      (setq output
 -            (format "This variable was introduced, or its default value was changed, in\nversion %s of Emacs.\n"
 -                    custom-version))
 -      (when cpv
 -      (let* ((package (car-safe cpv))
 -             (version (car (cdr-safe cpv)))
 -             (pkg-versions (assq package customize-package-emacs-version-alist))
 -             (emacsv (cdr (assoc version pkg-versions))))
 -        (if (and package version)
 -            (setq output
 -                  (format (concat "This variable was introduced, or its default value was changed, in\nversion %s of the %s package"
 -                                  (if emacsv
 -                                      (format " that is part of Emacs %s" emacsv))
 -                                  ".\n")
 -                          version package))))))
 -    output))
 -
  ;;;###autoload
  (defun describe-variable (variable &optional buffer frame)
    "Display the full documentation of VARIABLE (a symbol).
@@@ -643,16 -668,23 +646,16 @@@ it is displayed along with the global v
              (with-current-buffer standard-output
                (insert (or doc "Not documented as a variable."))))
            ;; Make a link to customize if this variable can be customized.
 -          (when (custom-variable-p variable)
 -            (let ((customize-label "customize"))
 -              (terpri)
 -              (terpri)
 -              (princ (concat "You can " customize-label " this variable."))
 -              (with-current-buffer standard-output
 -                (save-excursion
 -                  (re-search-backward
 -                   (concat "\\(" customize-label "\\)") nil t)
 -                  (help-xref-button 1 'help-customize-variable variable))))
 -            ;; Note variable's version or package version
 -            (let ((output (describe-variable-custom-version-info variable)))
 -              (when output
 +          (if (custom-variable-p variable)
 +              (let ((customize-label "customize"))
                  (terpri)
                  (terpri)
 -                (princ output))))
 -
 +                (princ (concat "You can " customize-label " this variable."))
 +                (with-current-buffer standard-output
 +                  (save-excursion
 +                    (re-search-backward
 +                     (concat "\\(" customize-label "\\)") nil t)
 +                    (help-xref-button 1 'help-customize-variable variable)))))
            (print-help-return-message)
            (save-excursion
              (set-buffer standard-output)
diff --combined lisp/smerge-mode.el
index 5d4400958d6d09180de136df9559257c5d7a553d,16693f8a5e3a83d05d1009d540b6b54b33b96cb3..a33d21925b7cf2b390fc4931ef0522585e2a215c
@@@ -79,6 -79,10 +79,6 @@@ Used in `smerge-diff-base-mine' and rel
    :group 'smerge
    :type 'boolean)
  
 -(defcustom smerge-auto-refine t
 -  "Automatically highlight changes in detail as the user visits conflicts."
 -  :type 'boolean)
 -
  (defface smerge-mine
    '((((min-colors 88) (background light))
       (:foreground "blue1"))
@@@ -252,7 -256,9 +252,7 @@@ Can be nil if the style is undecided, o
  ;;;;
  
  ;; Define smerge-next and smerge-prev
 -(easy-mmode-define-navigation smerge smerge-begin-re "conflict" nil nil
 -  (if smerge-auto-refine
 -      (condition-case nil (smerge-refine) (error nil))))
 +(easy-mmode-define-navigation smerge smerge-begin-re "conflict")
  
  (defconst smerge-match-names ["conflict" "mine" "base" "other"])
  
@@@ -433,6 -439,12 +433,6 @@@ some major modes.  Uses `smerge-resolve
        (error "`smerge-batch-resolve' is to be used only with -batch"))
    (while command-line-args-left
      (let ((file (pop command-line-args-left)))
 -      (if (string-match "\\.rej\\'" file)
 -          ;; .rej files should never contain diff3 markers, on the other hand,
 -          ;; in Arch, .rej files are sometimes used to indicate that the
 -          ;; main file has diff3 markers.  So you can pass **/*.rej and
 -          ;; it will DTRT.
 -          (setq file (substring file 0 (match-beginning 0))))
        (message "Resolving conflicts in %s..." file)
        (when (file-readable-p file)
          (with-current-buffer (find-file-noselect file)
@@@ -645,50 -657,119 +645,119 @@@ Point is moved to the end of the confli
          (error nil)))
      found))
  
+ ;;; Refined change highlighting
+ (defvar smerge-refine-forward-function 'smerge-refine-forward
+   "Function used to determine an \"atomic\" element.
+ You can set it to `forward-char' to get char-level granularity.
+ Its behavior has mainly two restrictions:
+ - if this function encounters a newline, it's important that it stops right
+   after the newline.
+   This only matters if `smerge-refine-ignore-whitespace' is nil.
+ - it needs to be unaffected by changes performed by the `preproc' argument
+   to `smerge-refine-subst'.
+   This only matters if `smerge-refine-weight-hack' is nil.")
+ (defvar smerge-refine-ignore-whitespace t
+   "If non-nil,Indicate that smerge-refine should try to ignore change in whitespace.")
+ (defvar smerge-refine-weight-hack t
+   "If non-nil, pass to diff as many lines as there are chars in the region.
+ I.e. each atomic element (e.g. word) will be copied as many times (on different
+ lines) as it has chars.  This has 2 advantages:
+ - if `diff' tries to minimize the number *lines* (rather than chars)
+   added/removed, this adjust the weights so that adding/removing long
+   symbols is considered correspondingly more costly.
+ - `smerge-refine-forward-function' only needs to be called when chopping up
+   the regions, and `forward-char' can be used afterwards.
+ It has the following disadvantages:
+ - cannot use `diff -w' because the weighting causes added spaces in a line
+   to be represented as added copies of some line, so `diff -w' can't do the
+   right thing any more.
+ - may in degenerate cases take a 1KB input region and turn it into a 1MB
+   file to pass to diff.")
+ (defun smerge-refine-forward (n)
+   (let ((case-fold-search nil)
+         (re "[[:upper:]]?[[:lower:]]+\\|[[:upper:]]+\\|[[:digit:]]+\\|.\\|\n"))
+     (when (and smerge-refine-ignore-whitespace
+                ;; smerge-refine-weight-hack causes additional spaces to
+                ;; appear as additional lines as well, so even if diff ignore
+                ;; whitespace changes, it'll report added/removed lines :-(
+                (not smerge-refine-weight-hack))
+       (setq re (concat "[ \t]*\\(?:" re "\\)")))
+     (dotimes (i n)
+       (unless (looking-at re) (error "Smerge refine internal error"))
+       (goto-char (match-end 0)))))
  (defun smerge-refine-chopup-region (beg end file &optional preproc)
    "Chopup the region into small elements, one per line.
  Save the result into FILE.
  If non-nil, PREPROC is called with no argument in a buffer that contains
  a copy of the text, just before chopping it up.  It can be used to replace
  chars to try and eliminate some spurious differences."
-   ;; ediff chops up into words, where the definition of a word is
-   ;; customizable.  Instead we here keep only one char per line.
-   ;; The advantages are that there's nothing to configure, that we get very
-   ;; fine results, and that it's trivial to map the line numbers in the
-   ;; output of diff back into buffer positions.  The disadvantage is that it
-   ;; can take more time to compute the diff and that the result is sometimes
-   ;; too fine.  I'm not too concerned about the slowdown because conflicts
-   ;; are usually significantly smaller than the whole file.  As for the
-   ;; problem of too-fine-refinement, I have found it to be unimportant
-   ;; especially when you consider the cases where the fine-grain is just
-   ;; what you want.
+   ;; We used to chop up char-by-char rather than word-by-word like ediff
+   ;; does.  It had the benefit of simplicity and very fine results, but it
+   ;; often suffered from problem that diff would find correlations where
+   ;; there aren't any, so the resulting "change" didn't make much sense.
+   ;; You can still get this behavior by setting
+   ;; `smerge-refine-forward-function' to `forward-char'.
    (let ((buf (current-buffer)))
      (with-temp-buffer
        (insert-buffer-substring buf beg end)
        (when preproc (goto-char (point-min)) (funcall preproc))
+       (when smerge-refine-ignore-whitespace
+         ;; It doesn't make much of a difference for diff-fine-highlight
+         ;; because we still have the _/+/</>/! prefix anyway.  Can still be
+         ;; useful in other circumstances.
+         (subst-char-in-region (point-min) (point-max) ?\n ?\s))
        (goto-char (point-min))
        (while (not (eobp))
-         (forward-char 1)
-         ;; We add \n after each char except after \n, so we get one line per
-         ;; text char, where each line contains just one char, except for \n
-         ;; chars which are represented by the empty line.
-         (unless (eq (char-before) ?\n) (insert ?\n)))
+         (funcall smerge-refine-forward-function 1)
+         (let ((s (if (prog2 (forward-char -1) (bolp) (forward-char 1))
+                      nil
+                    (buffer-substring (line-beginning-position) (point)))))
+           ;; We add \n after each char except after \n, so we get
+           ;; one line per text char, where each line contains
+           ;; just one char, except for \n chars which are
+           ;; represented by the empty line.
+           (unless (eq (char-before) ?\n) (insert ?\n))
+           ;; HACK ALERT!!
+           (if smerge-refine-weight-hack
+               (dotimes (i (1- (length s))) (insert s "\n")))))
+       (unless (bolp) (error "Smerge refine internal error"))
        (let ((coding-system-for-write 'emacs-mule))
          (write-region (point-min) (point-max) file nil 'nomessage)))))
  
  (defun smerge-refine-highlight-change (buf beg match-num1 match-num2 props)
-   (let* ((startline (string-to-number (match-string match-num1)))
-          (ol (make-overlay
-               (+ beg startline -1)
-               (+ beg (if (match-end match-num2)
-                          (string-to-number (match-string match-num2))
-                        startline))
-               buf
-               ;; Make them tend to shrink rather than spread when editing.
-               'front-advance nil)))
-     (overlay-put ol 'evaporate t)
-     (dolist (x props)
-       (overlay-put ol (car x) (cdr x)))))
+   (with-current-buffer buf
+     (goto-char beg)
+     (let* ((startline (- (string-to-number match-num1) 1))
+            (beg (progn (funcall (if smerge-refine-weight-hack
+                                     'forward-char
+                                   smerge-refine-forward-function)
+                                 startline)
+                        (point)))
+            (end (progn (funcall (if smerge-refine-weight-hack
+                                     'forward-char
+                                   smerge-refine-forward-function)
+                           (if match-num2
+                               (- (string-to-number match-num2)
+                                  startline)
+                             1))
+                        (point))))
+       (when smerge-refine-ignore-whitespace
+         (skip-chars-backward " \t\n" beg) (setq end (point))
+         (goto-char beg)
+         (skip-chars-forward " \t\n" end)  (setq beg (point)))
+       (when (> end beg)
+         (let ((ol (make-overlay
+                    beg end nil
+                    ;; Make them tend to shrink rather than spread when editing.
+                    'front-advance nil)))
+           (overlay-put ol 'evaporate t)
+           (dolist (x props) (overlay-put ol (car x) (cdr x)))
+           ol)))))
  
  (defun smerge-refine-subst (beg1 end1 beg2 end2 props &optional preproc)
    "Show fine differences in the two regions BEG1..END1 and BEG2..END2.
@@@ -697,9 -778,9 +766,9 @@@ If non-nil, PREPROC is called with no a
  a copy of a region, just before preparing it to for `diff'.  It can be used to
  replace chars to try and eliminate some spurious differences."
    (let* ((buf (current-buffer))
+          (pos (point))
           (file1 (make-temp-file "diff1"))
           (file2 (make-temp-file "diff2")))
      ;; Chop up regions into smaller elements and save into files.
      (smerge-refine-chopup-region beg1 end1 file1 preproc)
      (smerge-refine-chopup-region beg2 end2 file2 preproc)
            (let ((coding-system-for-read 'emacs-mule))
              ;; Don't forget -a to make sure diff treats it as a text file
              ;; even if it contains \0 and such.
-             (call-process diff-command nil t nil "-a" file1 file2))
+             (call-process diff-command nil t nil
+                           (if (and smerge-refine-ignore-whitespace
+                                    (not smerge-refine-weight-hack))
+                               "-aw" "-a")
+                           file1 file2))
            ;; Process diff's output.
            (goto-char (point-min))
-           (while (not (eobp))
-             (if (not (looking-at "\\([0-9]+\\)\\(?:,\\([0-9]+\\)\\)?\\([acd]\\)\\([0-9]+\\)\\(?:,\\([0-9]+\\)\\)?$"))
-                 (error "Unexpected patch hunk header: %s"
-                        (buffer-substring (point) (line-end-position)))
-               (let ((op (char-after (match-beginning 3))))
+           (let ((last1 nil)
+                 (last2 nil))
+             (while (not (eobp))
+               (if (not (looking-at "\\([0-9]+\\)\\(?:,\\([0-9]+\\)\\)?\\([acd]\\)\\([0-9]+\\)\\(?:,\\([0-9]+\\)\\)?$"))
+                   (error "Unexpected patch hunk header: %s"
+                          (buffer-substring (point) (line-end-position))))
+               (let ((op (char-after (match-beginning 3)))
+                     (m1 (match-string 1))
+                     (m2 (match-string 2))
+                     (m4 (match-string 4))
+                     (m5 (match-string 5)))
                  (when (memq op '(?d ?c))
-                   (smerge-refine-highlight-change buf beg1 1 2 props))
+                   (setq last1
+                         (smerge-refine-highlight-change buf beg1 m1 m2 props)))
                  (when (memq op '(?a ?c))
-                   (smerge-refine-highlight-change buf beg2 4 5 props)))
+                   (setq last2
+                         (smerge-refine-highlight-change buf beg2 m4 m5 props))))
                (forward-line 1)                            ;Skip hunk header.
                (and (re-search-forward "^[0-9]" nil 'move) ;Skip hunk body.
-                    (goto-char (match-beginning 0))))))
+                    (goto-char (match-beginning 0))))
+             ;; (assert (or (null last1) (< (overlay-start last1) end1)))
+             ;; (assert (or (null last2) (< (overlay-start last2) end2)))
+             (if smerge-refine-weight-hack
+                 (progn
+                   ;; (assert (or (null last1) (<= (overlay-end last1) end1)))
+                   ;; (assert (or (null last2) (<= (overlay-end last2) end2)))
+                   )
+               ;; smerge-refine-forward-function when calling in chopup may
+               ;; have stopped because it bumped into EOB whereas in
+               ;; smerge-refine-weight-hack it may go a bit further.
+               (if (and last1 (> (overlay-end last1) end1))
+                   (move-overlay last1 (overlay-start last1) end1))
+               (if (and last2 (> (overlay-end last2) end2))
+                   (move-overlay last2 (overlay-start last2) end2))
+               )))
+       (goto-char pos)
        (delete-file file1)
        (delete-file file2))))
  
diff --combined src/Makefile.in
index 6fce595a9ec1c17f36fba5507c3302ce02a59697,7119f94c8d2418b329ead6aeedb4017cb0c8cc1b..1ff7ce3033917ab2738aa56509b391a83f44853e
@@@ -51,7 -51,6 +51,7 @@@ LIBOBJS = @LIBOBJS
  dot = .
  dotdot = ${dot}${dot}
  lispsource = ${srcdir}/$(dot)$(dot)/lisp/
 +admindir = $(srcdir)/$(dot)$(dot)/admin/
  libsrc = $(dot)$(dot)/lib-src/
  etc = $(dot)$(dot)/etc/
  oldXMenudir = $(dot)$(dot)/oldXMenu/
@@@ -276,7 -275,7 +276,7 @@@ TOOLKIT_DEFINES 
  
  /* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM
     since it may have -I options that should override those two.  */
 -ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${CFLAGS}
 +ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@
  .c.o:
        $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
  
@@@ -460,6 -459,13 +460,13 @@@ LIBX= $(LIBXMENU) LD_SWITCH_X_SITE -lX1
  #define LIBGPM
  #endif /* not HAVE_GPM */
  
+ #if HAVE_LIBRESOLV
+ #ifndef LIBRESOLV
+ #define LIBRESOLV -lresolv
+ #endif /* not defined LIBRESOLV */
+ #else /* not HAVE_LIBRESOLV */
+ #define LIBRESOLV
+ #endif /* not HAVE_LIBRESOLV */
  
  LIBSOUND= @LIBSOUND@
  CFLAGS_SOUND= @CFLAGS_SOUND@
@@@ -586,27 -592,10 +593,27 @@@ emacsapp = $(PWD)/$(mac)Emacs.app
  emacsappsrc = ${srcdir}/../mac/Emacs.app/
  #endif
  
 +#ifdef HAVE_WINDOW_SYSTEM
 +#ifdef USE_FONT_BACKEND
 +FONTSRC = font.h
 +#ifdef HAVE_X_WINDOWS
 +#if defined (HAVE_XFT)
 +FONTOBJ = font.o xfont.o ftfont.o xftfont.o ftxfont.o
 +#elif defined (HAVE_FREETYPE)
 +FONTOBJ = font.o xfont.o ftfont.o ftxfont.o
 +#else /* ! defined (HAVE_XFT) && ! defined (HAVE_FREETYPE) */
 +FONTOBJ = font.o xfont.o
 +#endif /* ! defined (HAVE_XFT) && ! defined (HAVE_FREETYPE) */
 +#else /* ! HAVE_X_WINDOWS */
 +FONTOBJ = font.o
 +#endif /* ! HAVE_X_WINDOWS */
 +#endif /* USE_FONT_BACKEND */
 +#endif /* HAVE_WINDOW_SYSTEM */
 +
  /* lastfile must follow all files
     whose initialized data areas should be dumped as pure by dump-emacs.  */
  obj=    dispnew.o frame.o scroll.o xdisp.o $(XMENU_OBJ) window.o \
 -      charset.o coding.o category.o ccl.o \
 +      charset.o coding.o category.o ccl.o character.o chartab.o \
        cm.o term.o terminal.o xfaces.o $(XOBJ) $(GTK_OBJ)\
        emacs.o keyboard.o macros.o keymap.o sysdep.o \
        buffer.o filelock.o insdel.o marker.o \
        process.o callproc.o \
        region-cache.o sound.o atimer.o \
        doprnt.o strftime.o intervals.o textprop.o composite.o md5.o \
 -      $(MSDOS_OBJ) $(MAC_OBJ) $(CYGWIN_OBJ)
 +      $(MSDOS_OBJ) $(MAC_OBJ) $(CYGWIN_OBJ) $(FONTOBJ)
  
  /* Object files used on some machine or other.
     These go in the DOC file on all machines
@@@ -627,7 -616,7 +634,7 @@@ SOME_MACHINE_OBJECTS = sunfns.o dosfns.
    xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
    mac.o macterm.o macfns.o macmenu.o macselect.o fontset.o \
    w32.o w32bdf.o w32console.o w32fns.o w32heap.o w32inevt.o \
 -  w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o
 +  w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONTOBJ)
  
  
  #ifdef TERMINFO
@@@ -749,7 -738,6 +756,7 @@@ lisp= 
        ${lispsource}buff-menu.elc \
        ${lispsource}button.elc \
        ${lispsource}emacs-lisp/byte-run.elc \
 +      ${lispsource}composite.elc \
        ${lispsource}cus-face.elc \
        ${lispsource}cus-start.elc \
        ${lispsource}custom.elc \
        ${lispsource}international/mule-conf.el \
        ${lispsource}international/mule-cmds.elc \
        ${lispsource}international/characters.elc \
 -      ${lispsource}international/ucs-tables.elc \
 -      ${lispsource}international/utf-8.elc \
 -      ${lispsource}international/utf-16.elc \
 -      ${lispsource}international/latin-1.el \
 -      ${lispsource}international/latin-2.el \
 -      ${lispsource}international/latin-3.el \
 -      ${lispsource}international/latin-4.el \
 -      ${lispsource}international/latin-5.el \
 -      ${lispsource}international/latin-8.el \
 -      ${lispsource}international/latin-9.el \
 +      ${lispsource}international/charprop.el \
        ${lispsource}case-table.elc \
 -      ${lispsource}language/chinese.elc \
 -      ${lispsource}language/cyrillic.elc \
 -      ${lispsource}language/indian.elc \
 +      ${lispsource}language/chinese.el \
 +      ${lispsource}language/cyrillic.el \
 +      ${lispsource}language/indian.el \
        ${lispsource}language/devanagari.el \
        ${lispsource}language/kannada.el \
        ${lispsource}language/malayalam.el \
        ${lispsource}language/japanese.el \
        ${lispsource}language/korean.el \
        ${lispsource}language/lao.el \
 +      ${lispsource}language/tai-viet.el \
        ${lispsource}language/thai.el \
        ${lispsource}language/tibetan.elc \
 -      ${lispsource}language/vietnamese.elc \
 +      ${lispsource}language/vietnamese.el \
        ${lispsource}language/misc-lang.el \
        ${lispsource}language/utf-8-lang.el \
        ${lispsource}language/georgian.el \
@@@ -841,7 -837,6 +848,7 @@@ shortlisp= 
        ../lisp/buff-menu.elc \
        ../lisp/button.elc \
        ../lisp/emacs-lisp/byte-run.elc \
 +      ../lisp/composite.elc \
        ../lisp/cus-face.elc \
        ../lisp/cus-start.elc \
        ../lisp/custom.elc \
        ../lisp/international/mule-conf.el \
        ../lisp/international/mule-cmds.elc \
        ../lisp/international/characters.elc \
 -      ../lisp/international/ucs-tables.elc \
 -      ../lisp/international/utf-8.elc \
 -      ../lisp/international/utf-16.elc \
 -      ../lisp/international/latin-1.el \
 -      ../lisp/international/latin-2.el \
 -      ../lisp/international/latin-3.el \
 -      ../lisp/international/latin-4.el \
 -      ../lisp/international/latin-5.el \
 -      ../lisp/international/latin-8.el \
 -      ../lisp/international/latin-9.el \
        ../lisp/case-table.elc \
 -      ../lisp/language/chinese.elc \
 -      ../lisp/language/cyrillic.elc \
 -      ../lisp/language/indian.elc \
 +      ../lisp/language/chinese.el \
 +      ../lisp/language/cyrillic.el \
 +      ../lisp/language/indian.el \
        ../lisp/language/devanagari.el \
        ../lisp/language/kannada.el \
        ../lisp/language/malayalam.el \
        ../lisp/language/japanese.el \
        ../lisp/language/korean.el \
        ../lisp/language/lao.el \
 +      ../lisp/language/tai-viet.el \
        ../lisp/language/thai.el \
        ../lisp/language/tibetan.elc \
 -      ../lisp/language/vietnamese.elc \
 +      ../lisp/language/vietnamese.el \
        ../lisp/language/misc-lang.el \
        ../lisp/language/utf-8-lang.el \
        ../lisp/language/georgian.el \
@@@ -943,10 -947,9 +950,10 @@@ SOME_MACHINE_LISP = ${dotdot}/lisp/mous
     duplicated symbols.  If the standard libraries were compiled
     with GCC, we might need gnulib again after them.  */
  LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) $(RSVG_LIBS) LIBGPM \
-    LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \
+    LIBRESOLV LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \
 -   LIBS_DEBUG $(GETLOADAVG_LIBS) $(GNULIB_VAR) LIB_MATH LIB_STANDARD \
 -   $(GNULIB_VAR)
 +   LIBS_DEBUG $(GETLOADAVG_LIBS) \
 +   @FREETYPE_LIBS@ @FONTCONFIG_LIBS@ @LIBOTF_LIBS@ \
 +   $(GNULIB_VAR) LIB_MATH LIB_STANDARD $(GNULIB_VAR)
  
  /* Enable recompilation of certain other files depending on system type.  */
  
  #define OBJECTS_MACHINE
  #endif
  
 -RUN_TEMACS = ./temacs
 +#ifdef HAVE_SHM
 +RUN_TEMACS = `/bin/pwd`/temacs -nl
 +#else
 +RUN_TEMACS = `/bin/pwd`/temacs
 +#endif
  
  all: emacs${EXEEXT} OTHER_FILES
  
@@@ -971,7 -970,11 +978,7 @@@ emacs${EXEEXT}: temacs${EXEEXT} ${etc}D
        rm -f emacs${EXEEXT}
        ln temacs${EXEEXT} emacs${EXEEXT}
  #else
 -#ifdef HAVE_SHM
 -      LC_ALL=C $(RUN_TEMACS) -nl -batch -l loadup dump
 -#else /* ! defined (HAVE_SHM) */
        LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump
 -#endif /* ! defined (HAVE_SHM) */
  #endif /* ! defined (CANNOT_DUMP) */
        -./emacs -q -batch -f list-load-path-shadows
  
@@@ -991,23 -994,13 +998,23 @@@ ${etc}DOC: ${libsrc}make-docfile${EXEEX
  ${libsrc}make-docfile${EXEEXT}:
        cd ${libsrc}; ${MAKE} ${MFLAGS} make-docfile${EXEEXT}
  
 +#ifdef HAVE_UNIDATA
 +UNIDATA=${admindir}unidata/UnicodeData.txt
 +
 +${lispsource}international/charprop.el: temacs${EXEEXT} ${UNIDATA}
 +      RUNEMACS="$(RUN_TEMACS)"; \
 +      cd ${admindir}unidata; \
 +      $(MAKE) $(MFLAGS) \
 +        RUNEMACS="$${RUNEMACS}" DSTDIR=${lispsource}international
 +#endif
 +
  /* Some systems define this to cause parallel Make-ing.  */
  #ifndef MAKE_PARALLEL
  #define MAKE_PARALLEL
  #endif
  
  temacs${EXEEXT}: MAKE_PARALLEL $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} OBJECTS_MACHINE prefix-args${EXEEXT}
 -      echo "${obj} ${otherobj} " OBJECTS_MACHINE > buildobj.lst
 +      echo "${obj} ${otherobj} " OBJECTS_MACHINE > ${etc}buildobj.lst
        $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \
      -o temacs ${STARTFILES} ${obj} ${otherobj}  \
      OBJECTS_MACHINE ${LIBES}
@@@ -1101,81 -1094,72 +1108,81 @@@ stamp-oldxmenu
     it is so often changed in ways that do not require any recompilation
     and so rarely changed in ways that do require any.  */
  
 -abbrev.o: abbrev.c buffer.h window.h dispextern.h commands.h charset.h \
 +abbrev.o: abbrev.c buffer.h window.h dispextern.h commands.h character.h \
        syntax.h $(config_h)
  buffer.o: buffer.c buffer.h region-cache.h commands.h window.h \
 -   dispextern.h $(INTERVAL_SRC) blockinput.h atimer.h systime.h charset.h \
 +   dispextern.h $(INTERVAL_SRC) blockinput.h atimer.h systime.h character.h \
     $(config_h)
  callint.o: callint.c window.h commands.h buffer.h keymap.h \
     keyboard.h dispextern.h $(config_h)
  callproc.o: callproc.c epaths.h buffer.h commands.h $(config_h) \
 -      process.h systty.h syssignal.h charset.h coding.h ccl.h msdos.h \
 +      process.h systty.h syssignal.h character.h coding.h ccl.h msdos.h \
          composite.h w32.h blockinput.h atimer.h systime.h frame.h termhooks.h
 -casefiddle.o: casefiddle.c syntax.h commands.h buffer.h composite.h \
 +casefiddle.o: casefiddle.c syntax.h commands.h buffer.h character.h \
 +   composite.h \
        charset.h keymap.h $(config_h)
  casetab.o: casetab.c buffer.h $(config_h)
 -category.o: category.c category.h buffer.h charset.h keymap.h $(config_h)
 -ccl.o: ccl.c ccl.h charset.h coding.h $(config_h)
 -charset.o: charset.c charset.h buffer.h coding.h composite.h disptab.h \
 -      $(config_h)
 -coding.o: coding.c coding.h ccl.h buffer.h charset.h intervals.h composite.h \
 +category.o: category.c category.h buffer.h charset.h keymap.h \
 +      character.h $(config_h)
 +ccl.o: ccl.c ccl.h charset.h character.h coding.h $(config_h)
 +character.o: character.c character.h buffer.h charset.h composite.h disptab.h \
 +   $(config.h)
 +charset.o: charset.c charset.h character.h buffer.h coding.h composite.h \
 +   disptab.h $(config_h)
 +chartab.o: charset.h character.h $(config.h)
 +coding.o: coding.c coding.h ccl.h buffer.h character.h charset.h intervals.h composite.h \
        window.h dispextern.h frame.h termhooks.h $(config_h)
  cm.o: cm.c frame.h cm.h termhooks.h termchar.h $(config_h)
 -cmds.o: cmds.c syntax.h buffer.h charset.h commands.h window.h $(config_h) \
 +cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h $(config_h) \
        msdos.h dispextern.h keyboard.h keymap.h
  pre-crt0.o: pre-crt0.c
  ecrt0.o: ecrt0.c $(config_h)
        CRT0_COMPILE ${srcdir}/ecrt0.c
 -dired.o: dired.c commands.h buffer.h $(config_h) charset.h coding.h regex.h \
 -   systime.h blockinput.h atimer.h
 +dired.o: dired.c commands.h buffer.h $(config_h) character.h charset.h \
 +   coding.h regex.h systime.h blockinput.h atimer.h
  dispnew.o: dispnew.c systime.h commands.h process.h frame.h \
     window.h buffer.h dispextern.h termchar.h termopts.h termhooks.h cm.h \
     disptab.h indent.h intervals.h \
 -   xterm.h blockinput.h atimer.h charset.h msdos.h composite.h keyboard.h \
 +   xterm.h blockinput.h atimer.h character.h msdos.h composite.h keyboard.h \
     $(config_h)
 -doc.o: doc.c $(config_h) epaths.h buffer.h keyboard.h keymap.h charset.h
 -doprnt.o: doprnt.c charset.h $(config_h)
 +doc.o: doc.c $(config_h) epaths.h buffer.h keyboard.h keymap.h character.h
 +doprnt.o: doprnt.c character.h $(config_h)
  dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \
     msdos.h dosfns.h dispextern.h charset.h coding.h atimer.h systime.h \
     $(config_h)
 -editfns.o: editfns.c window.h buffer.h systime.h $(INTERVAL_SRC) charset.h \
 +editfns.o: editfns.c window.h buffer.h systime.h $(INTERVAL_SRC) character.h \
     coding.h dispextern.h frame.h blockinput.h atimer.h $(config_h)
  emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \
     termhooks.h buffer.h atimer.h systime.h $(INTERVAL_SRC) $(config_h) \
     window.h dispextern.h keyboard.h keymap.h
 -fileio.o: fileio.c window.h buffer.h systime.h $(INTERVAL_SRC) charset.h \
 +fileio.o: fileio.c window.h buffer.h systime.h $(INTERVAL_SRC) character.h \
     coding.h msdos.h dispextern.h blockinput.h atimer.h $(config_h)
 -filelock.o: filelock.c buffer.h charset.h coding.h systime.h epaths.h $(config_h)
 +filelock.o: filelock.c buffer.h character.h charset.h coding.h systime.h \
 +   epaths.h $(config_h)
  filemode.o: filemode.c  $(config_h)
  frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \
 -   blockinput.h atimer.h systime.h buffer.h charset.h fontset.h \
 +   blockinput.h atimer.h systime.h buffer.h character.h fontset.h \
     msdos.h dosfns.h dispextern.h w32term.h macterm.h termchar.h $(config_h)
  fringe.o: fringe.c dispextern.h frame.h window.h buffer.h termhooks.h $(config_h)
 -fontset.o: dispextern.h fontset.h fontset.c ccl.h buffer.h charset.h frame.h \
 -   keyboard.h termhooks.h $(config_h)
 +font.o: font.c dispextern.h frame.h window.h ccl.h character.h charset.h \
 +   font.h $(config_h)
 +ftfont.o: dispextern.h frame.h character.h charset.h font.h $(config_h)
 +fontset.o: dispextern.h fontset.h fontset.c ccl.h buffer.h character.h \
 +   charset.h frame.h keyboard.h termhooks.h $(FONTSRC) $(config_h)
  getloadavg.o: getloadavg.c $(config_h)
  image.o: image.c frame.h window.h dispextern.h blockinput.h atimer.h \
     systime.h xterm.h w32term.h w32gui.h macterm.h macgui.h $(config_h)
  indent.o: indent.c frame.h window.h indent.h buffer.h $(config_h) termchar.h \
 -   termopts.h disptab.h region-cache.h charset.h composite.h dispextern.h \
 -   keyboard.h
 -insdel.o: insdel.c window.h buffer.h $(INTERVAL_SRC) blockinput.h charset.h \
 +   termopts.h disptab.h region-cache.h character.h category.h composite.h \
 +   dispextern.h keyboard.h
 +insdel.o: insdel.c window.h buffer.h $(INTERVAL_SRC) blockinput.h character.h \
     dispextern.h atimer.h systime.h region-cache.h $(config_h)
 -keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h charset.h \
 +keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h character.h \
     commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \
     systime.h dispextern.h syntax.h $(INTERVAL_SRC) blockinput.h \
     atimer.h xterm.h puresize.h msdos.h keymap.h w32term.h macterm.h $(config_h)
  keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \
 -   atimer.h systime.h puresize.h charset.h intervals.h keymap.h window.h \
 +   atimer.h systime.h puresize.h character.h intervals.h keymap.h window.h \
     $(config_h)
  lastfile.o: lastfile.c  $(config_h)
  macros.o: macros.c window.h buffer.h commands.h macros.h keyboard.h \
@@@ -1184,37 -1168,35 +1191,37 @@@ malloc.o: malloc.c $(config_h
  gmalloc.o: gmalloc.c $(config_h)
  ralloc.o: ralloc.c $(config_h)
  vm-limit.o: vm-limit.c mem-limits.h $(config_h)
 -marker.o: marker.c buffer.h charset.h $(config_h)
 +marker.o: marker.c buffer.h character.h $(config_h)
  md5.o: md5.c md5.h $(config_h)
  minibuf.o: minibuf.c syntax.h dispextern.h frame.h window.h keyboard.h \
 -   buffer.h commands.h charset.h msdos.h $(INTERVAL_SRC) keymap.h \
 +   buffer.h commands.h character.h msdos.h $(INTERVAL_SRC) keymap.h \
     termhooks.h $(config_h)
  mktime.o: mktime.c $(config_h)
  msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \
 -   termopts.h termchar.h charset.h coding.h ccl.h disptab.h window.h \
 +   termopts.h termchar.h character.h coding.h ccl.h disptab.h window.h \
     keyboard.h intervals.h buffer.h commands.h blockinput.h atimer.h $(config_h)
  process.o: process.c process.h buffer.h window.h termhooks.h termopts.h \
     commands.h syssignal.h systime.h systty.h syswait.h frame.h dispextern.h \
     blockinput.h atimer.h charset.h coding.h ccl.h msdos.h composite.h \
     keyboard.h $(config_h)
 -regex.o: regex.c syntax.h buffer.h $(config_h) regex.h category.h charset.h
 +regex.o: regex.c syntax.h buffer.h $(config_h) regex.h category.h character.h \
 +   charset.h
  region-cache.o: region-cache.c buffer.h region-cache.h $(config_h)
  scroll.o: scroll.c termchar.h dispextern.h frame.h msdos.h keyboard.h \
     termhooks.h $(config_h)
  search.o: search.c regex.h commands.h buffer.h region-cache.h syntax.h \
 -   blockinput.h atimer.h systime.h category.h charset.h composite.h \
 -   $(INTERVAL_SRC) $(config_h)
 +   blockinput.h atimer.h systime.h category.h character.h charset.h \
 +   composite.h $(INTERVAL_SRC) \
 +   $(config_h)
  strftime.o: strftime.c $(config_h)
 -syntax.o: syntax.c syntax.h buffer.h commands.h category.h charset.h \
 +syntax.o: syntax.c syntax.h buffer.h commands.h category.h character.h \
     composite.h keymap.h regex.h $(INTERVAL_SRC) $(config_h)
  sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \
     process.h dispextern.h termhooks.h termchar.h termopts.h \
     frame.h atimer.h window.h msdos.h dosfns.h keyboard.h cm.h $(config_h)
  term.o: term.c termchar.h termhooks.h termopts.h $(config_h) cm.h frame.h \
 -   disptab.h dispextern.h keyboard.h charset.h coding.h ccl.h msdos.h \
 -   window.h keymap.h blockinput.h atimer.h systime.h
 +   disptab.h dispextern.h keyboard.h character.h charset.h coding.h ccl.h \
 +   msdos.h window.h keymap.h blockinput.h atimer.h systime.h
  termcap.o: termcap.c $(config_h)
  terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \
     keyboard.h $(config_h)
@@@ -1233,32 -1215,24 +1240,32 @@@ window.o: window.c indent.h commands.h 
     disptab.h keyboard.h dispextern.h msdos.h composite.h \
     keymap.h blockinput.h atimer.h systime.h $(INTERVAL_SRC) \
     xterm.h w32term.h macterm.h $(config_h)
 -xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h coding.h \
 -   termchar.h frame.h window.h disptab.h termhooks.h charset.h $(config_h) \
 -   keyboard.h $(INTERVAL_SRC) region-cache.h xterm.h w32term.h macterm.h \
 -   msdos.h composite.h fontset.h blockinput.h atimer.h systime.h keymap.h
 -xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h \
 -   window.h charset.h msdos.h dosfns.h composite.h atimer.h systime.h \
 -   keyboard.h fontset.h w32term.h macterm.h $(INTERVAL_SRC) termchar.h \
 -   termhooks.h $(config_h)
 +xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h \
 +   coding.h termchar.h frame.h window.h disptab.h termhooks.h character.h     \
 +   charset.h $(config_h) keyboard.h $(INTERVAL_SRC) region-cache.h xterm.h    \
 +   w32term.h macterm.h msdos.h composite.h fontset.h blockinput.h atimer.h    \
 +   systime.h keymap.h $(FONTSRC)
 +xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h \
 +   window.h character.h charset.h msdos.h dosfns.h composite.h atimer.h       \
 +   systime.h keyboard.h fontset.h w32term.h macterm.h $(INTERVAL_SRC) \
 +   termchar.h termhooks.h $(FONTSRC) $(config_h)
  xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \
     $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \
 -   charset.h gtkutil.h termchar.h termhooks.h $(config_h)
 +   character.h charset.h coding.h gtkutil.h $(config_h) termhooks.h \
 +   fontset.h termchar.h $(FONTSRC)
 +xfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
 +   font.h $(config_h)
 +xftfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
 +   font.h $(config_h)
 +ftxfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
 +   font.h $(config_h)
  xmenu.o: xmenu.c xterm.h termhooks.h window.h dispextern.h frame.h buffer.h \
 -   keyboard.h $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h \
 -   gtkutil.h msdos.h coding.h $(config_h)
 +   charset.h keyboard.h $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h \
 +   systime.h gtkutil.h msdos.h coding.h $(config_h)
  xterm.o: xterm.c xterm.h termhooks.h termopts.h termchar.h window.h buffer.h \
 -  dispextern.h frame.h disptab.h blockinput.h atimer.h systime.h syssignal.h \
 -  keyboard.h gnu.h charset.h ccl.h fontset.h composite.h \
 -  coding.h process.h gtkutil.h $(config_h)
 +   dispextern.h frame.h disptab.h blockinput.h atimer.h systime.h syssignal.h \
 +   keyboard.h gnu.h character.h charset.h ccl.h fontset.h composite.h \
 +   coding.h process.h gtkutil.h $(FONTSRC) $(config_h)
  xselect.o: xselect.c process.h dispextern.h frame.h xterm.h blockinput.h \
    buffer.h atimer.h systime.h termhooks.h $(config_h)
  xrdb.o: xrdb.c $(config_h) epaths.h
@@@ -1275,30 -1249,28 +1282,30 @@@ atimer.o: atimer.c atimer.h systime.h $
  /* The files of Lisp proper */
  
  alloc.o: alloc.c process.h frame.h window.h buffer.h  puresize.h syssignal.h keyboard.h \
 - blockinput.h atimer.h systime.h charset.h dispextern.h $(config_h) $(INTERVAL_SRC)
 -bytecode.o: bytecode.c buffer.h syntax.h charset.h window.h dispextern.h \
 + blockinput.h atimer.h systime.h character.h dispextern.h $(config_h) \
 + $(INTERVAL_SRC)
 +bytecode.o: bytecode.c buffer.h syntax.h character.h window.h dispextern.h \
    frame.h xterm.h $(config_h)
 -data.o: data.c buffer.h puresize.h charset.h syssignal.h keyboard.h frame.h termhooks.h $(config_h)
 +data.o: data.c buffer.h puresize.h character.h syssignal.h keyboard.h frame.h \
 +   termhooks.h $(config_h)
  eval.o: eval.c commands.h keyboard.h blockinput.h atimer.h systime.h \
    dispextern.h $(config_h)
  floatfns.o: floatfns.c $(config_h)
 -fns.o: fns.c commands.h $(config_h) frame.h buffer.h charset.h keyboard.h \
 +fns.o: fns.c commands.h $(config_h) frame.h buffer.h character.h keyboard.h \
   keymap.h frame.h window.h dispextern.h $(INTERVAL_SRC) coding.h md5.h \
   blockinput.h atimer.h systime.h xterm.h termhooks.h
 -print.o: print.c process.h frame.h window.h buffer.h keyboard.h charset.h \
 +print.o: print.c process.h frame.h window.h buffer.h keyboard.h character.h \
     $(config_h) dispextern.h termchar.h $(INTERVAL_SRC) msdos.h composite.h \
     blockinput.h atimer.h systime.h
 -lread.o: lread.c commands.h keyboard.h buffer.h epaths.h charset.h \
 - $(config_h) $(INTERVAL_SRC) termhooks.h coding.h msdos.h
 +lread.o: lread.c commands.h keyboard.h buffer.h epaths.h character.h \
 + charset.h $(config_h) $(INTERVAL_SRC) termhooks.h coding.h msdos.h
  
  /* Text properties support */
  textprop.o: textprop.c buffer.h window.h dispextern.h $(INTERVAL_SRC) \
        $(config_h)
  intervals.o: intervals.c buffer.h $(INTERVAL_SRC) keyboard.h puresize.h \
        keymap.h $(config_h)
 -composite.o: composite.c buffer.h  charset.h $(INTERVAL_SRC) $(config_h)
 +composite.o: composite.c buffer.h  character.h $(INTERVAL_SRC) $(config_h)
  
  /* System-specific programs to be made.
     OTHER_FILES and OBJECTS_MACHINE
@@@ -1356,7 -1328,7 +1363,7 @@@ mostlyclean
        rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a
        rm -f ../etc/DOC
        rm -f bootstrap-emacs${EXEEXT} emacs-${version}${EXEEXT}
 -      rm -f buildobj.lst
 +      rm -f ${etc}buildobj.lst
  clean: mostlyclean
        rm -f emacs-*${EXEEXT} emacs${EXEEXT}
  /**/# This is used in making a distribution.
@@@ -1403,10 -1375,14 +1410,10 @@@ bootstrap: bootstrap-emacs${EXEEXT
  /* Dump an Emacs executable named bootstrap-emacs containing the
     files from loadup.el in source form.  */
  
 -bootstrap-emacs${EXEEXT}: temacs${EXEEXT}
 +bootstrap-emacs${EXEEXT}: temacs${EXEEXT} ${lispsource}international/charprop.el
  #ifdef CANNOT_DUMP
        ln temacs${EXEEXT} bootstrap-emacs${EXEEXT}
  #else
 -#ifdef HAVE_SHM
 -      $(RUN_TEMACS) -nl -batch -l loadup bootstrap
 -#else /* ! defined (HAVE_SHM) */
        $(RUN_TEMACS) --batch --load loadup bootstrap
 -#endif /* ! defined (HAVE_SHM) */
        mv -f emacs${EXEEXT} bootstrap-emacs${EXEEXT}
  #endif /* ! defined (CANNOT_DUMP) */
diff --combined src/doc.c
index f491661a61658a5b9cf833f3155cf4c02d1fde11,53f645c6e5301dd55f56606df7d77d9330e54db4..c4af523baac12b62f764884d5552fce41fd30d24
+++ b/src/doc.c
@@@ -41,7 -41,7 +41,7 @@@ Boston, MA 02110-1301, USA.  *
  #include "lisp.h"
  #include "buffer.h"
  #include "keyboard.h"
 -#include "charset.h"
 +#include "character.h"
  #include "keymap.h"
  
  #ifdef HAVE_INDEX
@@@ -434,6 -434,18 +434,18 @@@ string is passed through `substitute-co
            doc = tem;
          else
            return Qnil;
+         /* Check for an advised function.  Its doc string
+            has an `ad-advice-info' text property.  */
+         if (STRINGP (doc))
+           {
+             Lisp_Object innerfunc;
+             innerfunc = Fget_text_property (make_number (0),
+                                             intern ("ad-advice-info"),
+                                             doc);
+             if (! NILP (innerfunc))
+               doc = call1 (intern ("ad-make-advised-docstring"), innerfunc);
+           }
        }
        else if (EQ (funcar, Qmacro))
        return Fdocumentation (Fcdr (fun), raw);
@@@ -617,10 -629,8 +629,10 @@@ the same file name is found in the `doc
      int nr_read;
      char *cp = NULL;
      char *beg, *end;
 +    Lisp_Object buildobj = Fexpand_file_name (build_string ("buildobj.lst"),
 +                                            Vdoc_directory);
  
 -    fd = emacs_open ("buildobj.lst", O_RDONLY, 0);
 +    fd = emacs_open (SDATA (buildobj), O_RDONLY, 0);
      if (fd < 0)
        report_file_error ("Opening file buildobj.lst", Qnil);
  
diff --combined src/process.c
index 6bcaef633031a147820d785a258bf139816c87d3,bbf754b971dd2dab886b6f90764fd0c4bff411c3..fb10bf2cc8bb871cc35d2903014ed33ed54b5426
@@@ -133,7 -133,7 +133,7 @@@ Boston, MA 02110-1301, USA.  *
  
  #include "window.h"
  #include "buffer.h"
 -#include "charset.h"
 +#include "character.h"
  #include "coding.h"
  #include "process.h"
  #include "frame.h"
@@@ -174,8 -174,8 +174,8 @@@ extern Lisp_Object QCfilter
     Qt nor Qnil but is instead a property list (KEY VAL ...).  */
  
  #ifdef HAVE_SOCKETS
 -#define NETCONN_P(p) (GC_CONSP (XPROCESS (p)->childp))
 -#define NETCONN1_P(p) (GC_CONSP ((p)->childp))
 +#define NETCONN_P(p) (CONSP (XPROCESS (p)->childp))
 +#define NETCONN1_P(p) (CONSP ((p)->childp))
  #else
  #define NETCONN_P(p) 0
  #define NETCONN1_P(p) 0
@@@ -679,7 -679,6 +679,7 @@@ setup_process_coding_systems (process
    struct Lisp_Process *p = XPROCESS (process);
    int inch = p->infd;
    int outch = p->outfd;
 +  Lisp_Object coding_system;
  
    if (inch < 0 || outch < 0)
      return;
    if (!proc_decode_coding_system[inch])
      proc_decode_coding_system[inch]
        = (struct coding_system *) xmalloc (sizeof (struct coding_system));
 -  setup_coding_system (p->decode_coding_system,
 -                     proc_decode_coding_system[inch]);
 +  coding_system = p->decode_coding_system;
    if (! NILP (p->filter))
      {
        if (!p->filter_multibyte)
 -      setup_raw_text_coding_system (proc_decode_coding_system[inch]);
 +      coding_system = raw_text_coding_system (coding_system);
      }
    else if (BUFFERP (p->buffer))
      {
        if (NILP (XBUFFER (p->buffer)->enable_multibyte_characters))
 -      setup_raw_text_coding_system (proc_decode_coding_system[inch]);
 +      coding_system = raw_text_coding_system (coding_system);
      }
 +  setup_coding_system (coding_system, proc_decode_coding_system[inch]);
  
    if (!proc_encode_coding_system[outch])
      proc_encode_coding_system[outch]
        = (struct coding_system *) xmalloc (sizeof (struct coding_system));
    setup_coding_system (p->encode_coding_system,
                       proc_encode_coding_system[outch]);
 -  if (proc_encode_coding_system[outch]->eol_type == CODING_EOL_UNDECIDED)
 -    proc_encode_coding_system[outch]->eol_type = system_eol_type;
  }
  \f
  DEFUN ("processp", Fprocessp, Sprocessp, 1, 1, 0,
@@@ -1006,7 -1007,7 +1006,7 @@@ DEFUN ("process-mark", Fprocess_mark, S
  DEFUN ("set-process-filter", Fset_process_filter, Sset_process_filter,
         2, 2, 0,
         doc: /* Give PROCESS the filter function FILTER; nil means no filter.
- t means stop accepting output from the process.
A value of t means stop accepting output from the process.
  
  When a process has a filter, its buffer is not used for output.
  Instead, each time it does output, the entire string of output is
@@@ -5161,13 -5162,13 +5161,13 @@@ read_process_output (proc, channel
         save the match data in a special nonrecursive fashion.  */
        running_asynch_code = 1;
  
 -      text = decode_coding_string (make_unibyte_string (chars, nbytes),
 -                                 coding, 0);
 -      Vlast_coding_system_used = coding->symbol;
 +      decode_coding_c_string (coding, chars, nbytes, Qt);
 +      text = coding->dst_object;
 +      Vlast_coding_system_used = CODING_ID_NAME (coding->id);
        /* A new coding system might be found.  */
 -      if (!EQ (p->decode_coding_system, coding->symbol))
 +      if (!EQ (p->decode_coding_system, Vlast_coding_system_used))
        {
 -        p->decode_coding_system = coding->symbol;
 +        p->decode_coding_system = Vlast_coding_system_used;
  
          /* Don't call setup_coding_system for
             proc_decode_coding_system[channel] here.  It is done in
          if (NILP (p->encode_coding_system)
              && proc_encode_coding_system[p->outfd])
            {
 -            p->encode_coding_system = coding->symbol;
 -            setup_coding_system (coding->symbol,
 +            p->encode_coding_system
 +              = coding_inherit_eol_type (Vlast_coding_system_used, Qnil);
 +            setup_coding_system (p->encode_coding_system,
                                   proc_encode_coding_system[p->outfd]);
 -            if (proc_encode_coding_system[p->outfd]->eol_type
 -                == CODING_EOL_UNDECIDED)
 -              proc_encode_coding_system[p->outfd]->eol_type
 -                = system_eol_type;
            }
        }
  
 -      carryover = nbytes - coding->consumed;
 -      if (carryover < 0)
 -      abort ();
 -
 -      if (SCHARS (p->decoding_buf) < carryover)
 -      p->decoding_buf = make_uninit_string (carryover);
 -      bcopy (chars + coding->consumed, SDATA (p->decoding_buf),
 -           carryover);
 -      p->decoding_carryover = carryover;
 +      if (coding->carryover_bytes > 0)
 +      {
 +        if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
 +          p->decoding_buf = make_uninit_string (coding->carryover_bytes);
 +        bcopy (coding->carryover, SDATA (p->decoding_buf),
 +               coding->carryover_bytes);
 +        p->decoding_carryover = coding->carryover_bytes;
 +      }
        /* Adjust the multibyteness of TEXT to that of the filter.  */
        if (!p->filter_multibyte != !STRING_MULTIBYTE (text))
        text = (STRING_MULTIBYTE (text)
        if (! (BEGV <= PT && PT <= ZV))
        Fwiden ();
  
 -      text = decode_coding_string (make_unibyte_string (chars, nbytes),
 -                                 coding, 0);
 -      Vlast_coding_system_used = coding->symbol;
 +      decode_coding_c_string (coding, chars, nbytes, Qt);
 +      text = coding->dst_object;
 +      Vlast_coding_system_used = CODING_ID_NAME (coding->id);
        /* A new coding system might be found.  See the comment in the
         similar code in the previous `if' block.  */
 -      if (!EQ (p->decode_coding_system, coding->symbol))
 +      if (!EQ (p->decode_coding_system, Vlast_coding_system_used))
        {
 -        p->decode_coding_system = coding->symbol;
 +        p->decode_coding_system = Vlast_coding_system_used;
          if (NILP (p->encode_coding_system)
              && proc_encode_coding_system[p->outfd])
            {
 -            p->encode_coding_system = coding->symbol;
 -            setup_coding_system (coding->symbol,
 +            p->encode_coding_system
 +              = coding_inherit_eol_type (Vlast_coding_system_used, Qnil);
 +            setup_coding_system (p->encode_coding_system,
                                   proc_encode_coding_system[p->outfd]);
 -            if (proc_encode_coding_system[p->outfd]->eol_type
 -                == CODING_EOL_UNDECIDED)
 -              proc_encode_coding_system[p->outfd]->eol_type
 -                = system_eol_type;
            }
        }
 -      carryover = nbytes - coding->consumed;
 -      if (carryover < 0)
 -      abort ();
 -
 -      if (SCHARS (p->decoding_buf) < carryover)
 -      p->decoding_buf = make_uninit_string (carryover);
 -      bcopy (chars + coding->consumed, SDATA (p->decoding_buf),
 -           carryover);
 -      p->decoding_carryover = carryover;
 -
 +      if (coding->carryover_bytes > 0)
 +      {
 +        if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
 +          p->decoding_buf = make_uninit_string (coding->carryover_bytes);
 +        bcopy (coding->carryover, SDATA (p->decoding_buf),
 +               coding->carryover_bytes);
 +        p->decoding_carryover = coding->carryover_bytes;
 +      }
        /* Adjust the multibyteness of TEXT to that of the buffer.  */
        if (NILP (current_buffer->enable_multibyte_characters)
          != ! STRING_MULTIBYTE (text))
@@@ -5428,19 -5438,24 +5428,19 @@@ send_process (proc, buf, len, object
      error ("Output file descriptor of %s is closed", SDATA (p->name));
  
    coding = proc_encode_coding_system[p->outfd];
 -  Vlast_coding_system_used = coding->symbol;
 +  Vlast_coding_system_used = CODING_ID_NAME (coding->id);
  
    if ((STRINGP (object) && STRING_MULTIBYTE (object))
        || (BUFFERP (object)
          && !NILP (XBUFFER (object)->enable_multibyte_characters))
        || EQ (object, Qt))
      {
 -      if (!EQ (coding->symbol, p->encode_coding_system))
 +      if (!EQ (Vlast_coding_system_used, p->encode_coding_system))
        /* The coding system for encoding was changed to raw-text
           because we sent a unibyte text previously.  Now we are
           sending a multibyte text, thus we must encode it by the
           original coding system specified for the current process.  */
        setup_coding_system (p->encode_coding_system, coding);
 -      if (coding->eol_type == CODING_EOL_UNDECIDED)
 -      coding->eol_type = system_eol_type;
 -      /* src_multibyte should be set to 1 _after_ a call to
 -       setup_coding_system, since it resets src_multibyte to
 -       zero.  */
        coding->src_multibyte = 1;
      }
    else
        /* For sending a unibyte text, character code conversion should
         not take place but EOL conversion should.  So, setup raw-text
         or one of the subsidiary if we have not yet done it.  */
 -      if (coding->type != coding_type_raw_text)
 +      if (CODING_REQUIRE_ENCODING (coding))
        {
          if (CODING_REQUIRE_FLUSHING (coding))
            {
              /* But, before changing the coding, we must flush out data.  */
              coding->mode |= CODING_MODE_LAST_BLOCK;
              send_process (proc, "", 0, Qt);
 +            coding->mode &= CODING_MODE_LAST_BLOCK;
            }
 +        setup_coding_system (raw_text_coding_system
 +                             (Vlast_coding_system_used),
 +                             coding);
          coding->src_multibyte = 0;
 -        setup_raw_text_coding_system (coding);
        }
      }
    coding->dst_multibyte = 0;
  
    if (CODING_REQUIRE_ENCODING (coding))
      {
 -      int require = encoding_buffer_size (coding, len);
 -      int from_byte = -1, from = -1, to = -1;
 -
 +      coding->dst_object = Qt;
        if (BUFFERP (object))
        {
 -        from_byte = BUF_PTR_BYTE_POS (XBUFFER (object), buf);
 -        from = buf_bytepos_to_charpos (XBUFFER (object), from_byte);
 -        to = buf_bytepos_to_charpos (XBUFFER (object), from_byte + len);
 +        int from_byte, from, to;
 +        int save_pt, save_pt_byte;
 +        struct buffer *cur = current_buffer;
 +
 +        set_buffer_internal (XBUFFER (object));
 +        save_pt = PT, save_pt_byte = PT_BYTE;
 +
 +        from_byte = PTR_BYTE_POS (buf);
 +        from = BYTE_TO_CHAR (from_byte);
 +        to = BYTE_TO_CHAR (from_byte + len);
 +        TEMP_SET_PT_BOTH (from, from_byte);
 +        encode_coding_object (coding, object, from, from_byte,
 +                              to, from_byte + len, Qt);
 +        TEMP_SET_PT_BOTH (save_pt, save_pt_byte);
 +        set_buffer_internal (cur);
        }
        else if (STRINGP (object))
        {
 -        from_byte = buf - SDATA (object);
 -        from = string_byte_to_char (object, from_byte);
 -        to =  string_byte_to_char (object, from_byte + len);
 +        encode_coding_string (coding, object, 1);
        }
 -
 -      if (coding->composing != COMPOSITION_DISABLED)
 +      else
        {
 -        if (from_byte >= 0)
 -          coding_save_composition (coding, from, to, object);
 -        else
 -          coding->composing = COMPOSITION_DISABLED;
 +        coding->dst_object = make_unibyte_string (buf, len);
 +        coding->produced = len;
        }
  
 -      if (SBYTES (p->encoding_buf) < require)
 -      p->encoding_buf = make_uninit_string (require);
 -
 -      if (from_byte >= 0)
 -      buf = (BUFFERP (object)
 -             ? BUF_BYTE_ADDRESS (XBUFFER (object), from_byte)
 -             : SDATA (object) + from_byte);
 -
 -      object = p->encoding_buf;
 -      encode_coding (coding, (char *) buf, SDATA (object),
 -                   len, SBYTES (object));
 -      coding_free_composition_data (coding);
        len = coding->produced;
 -      buf = SDATA (object);
 +      buf = SDATA (coding->dst_object);
      }
  
  #ifdef VMS
    UNGCPRO;
  }
  
 -static Lisp_Object
 -send_process_object_unwind (buf)
 -     Lisp_Object buf;
 -{
 -  Lisp_Object tembuf;
 -
 -  if (XBUFFER (buf) == current_buffer)
 -    return Qnil;
 -  tembuf = Fcurrent_buffer ();
 -  Fset_buffer (buf);
 -  Fkill_buffer (tembuf);
 -  return Qnil;
 -}
 -
 -/* Send current contents of region between START and END to PROC.
 -   If START is a string, send it instead.
 -   This function can evaluate Lisp code and can garbage collect.  */
 -
 -static void
 -send_process_object (proc, start, end)
 -     Lisp_Object proc, start, end;
 -{
 -  int count = SPECPDL_INDEX ();
 -  Lisp_Object object = STRINGP (start) ? start : Fcurrent_buffer ();
 -  struct buffer *given_buffer = current_buffer;
 -  unsigned char *buf;
 -  int len;
 -
 -  record_unwind_protect (send_process_object_unwind, Fcurrent_buffer ());
 -
 -  if (STRINGP (object) ? STRING_MULTIBYTE (object)
 -      : ! NILP (XBUFFER (object)->enable_multibyte_characters))
 -    {
 -      struct Lisp_Process *p = XPROCESS (proc);
 -      struct coding_system *coding;
 -
 -      if (p->raw_status_new)
 -      update_status (p);
 -      if (! EQ (p->status, Qrun))
 -      error ("Process %s not running", SDATA (p->name));
 -      if (p->outfd < 0)
 -      error ("Output file descriptor of %s is closed", SDATA (p->name));
 -
 -      coding = proc_encode_coding_system[p->outfd];
 -      if (! EQ (coding->symbol, p->encode_coding_system))
 -      /* The coding system for encoding was changed to raw-text
 -         because we sent a unibyte text previously.  Now we are
 -         sending a multibyte text, thus we must encode it by the
 -         original coding system specified for the current process.  */
 -      setup_coding_system (p->encode_coding_system, coding);
 -      if (! NILP (coding->pre_write_conversion))
 -      {
 -        struct gcpro gcpro1, gcpro2;
 -
 -        GCPRO2 (proc, object);
 -        call2 (coding->pre_write_conversion, start, end);
 -        UNGCPRO;
 -        if (given_buffer != current_buffer)
 -          {
 -            start = make_number (BEGV), end = make_number (ZV);
 -            object = Fcurrent_buffer ();
 -          }
 -      }
 -    }
 -
 -  if (BUFFERP (object))
 -    {
 -      EMACS_INT start_byte;
 -
 -      if (XINT (start) < GPT && XINT (end) > GPT)
 -      move_gap (XINT (end));
 -      start_byte = CHAR_TO_BYTE (XINT (start));
 -      buf = BYTE_POS_ADDR (start_byte);
 -      len = CHAR_TO_BYTE (XINT (end)) - start_byte;
 -    }
 -  else
 -    {
 -      buf = SDATA (object);
 -      len = SBYTES (object);
 -    }
 -  send_process (proc, buf, len, object);
 -
 -  unbind_to (count, Qnil);
 -}
 -
  DEFUN ("process-send-region", Fprocess_send_region, Sprocess_send_region,
         3, 3, 0,
         doc: /* Send current contents of region as input to PROCESS.
@@@ -5704,19 -5808,10 +5704,19 @@@ Output from processes can arrive in bet
       Lisp_Object process, start, end;
  {
    Lisp_Object proc;
 +  int start1, end1;
  
    proc = get_process (process);
    validate_region (&start, &end);
 -  send_process_object (proc, start, end);
 +
 +  if (XINT (start) < GPT && XINT (end) > GPT)
 +    move_gap (XINT (start));
 +
 +  start1 = CHAR_TO_BYTE (XINT (start));
 +  end1 = CHAR_TO_BYTE (XINT (end));
 +  send_process (proc, BYTE_POS_ADDR (start1), end1 - start1,
 +              Fcurrent_buffer ());
 +
    return Qnil;
  }
  
@@@ -5734,8 -5829,7 +5734,8 @@@ Output from processes can arrive in bet
    Lisp_Object proc;
    CHECK_STRING (string);
    proc = get_process (process);
 -  send_process_object (proc, string, Qnil);
 +  send_process (proc, SDATA (string),
 +              SBYTES (string), string);
    return Qnil;
  }
  \f
@@@ -6384,10 -6478,10 +6384,10 @@@ kill_buffer_processes (buffer
  {
    Lisp_Object tail, proc;
  
 -  for (tail = Vprocess_alist; GC_CONSP (tail); tail = XCDR (tail))
 +  for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
      {
        proc = XCDR (XCAR (tail));
 -      if (GC_PROCESSP (proc)
 +      if (PROCESSP (proc)
          && (NILP (buffer) || EQ (XPROCESS (proc)->buffer, buffer)))
        {
          if (NETCONN_P (proc))
@@@ -6482,11 -6576,11 +6482,11 @@@ sigchld_handler (signo
        /* Find the process that signaled us, and record its status.  */
  
        /* The process can have been deleted by Fdelete_process.  */
 -      for (tail = deleted_pid_list; GC_CONSP (tail); tail = XCDR (tail))
 +      for (tail = deleted_pid_list; CONSP (tail); tail = XCDR (tail))
        {
          Lisp_Object xpid = XCAR (tail);
 -        if ((GC_INTEGERP (xpid) && pid == (pid_t) XINT (xpid))
 -            || (GC_FLOATP (xpid) && pid == (pid_t) XFLOAT_DATA (xpid)))
 +        if ((INTEGERP (xpid) && pid == (pid_t) XINT (xpid))
 +            || (FLOATP (xpid) && pid == (pid_t) XFLOAT_DATA (xpid)))
            {
              XSETCAR (tail, Qnil);
              goto sigchld_end_of_loop;
  
        /* Otherwise, if it is asynchronous, it is in Vprocess_alist.  */
        p = 0;
 -      for (tail = Vprocess_alist; GC_CONSP (tail); tail = XCDR (tail))
 +      for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
        {
          proc = XCDR (XCAR (tail));
          p = XPROCESS (proc);
 -        if (GC_EQ (p->childp, Qt) && p->pid == pid)
 +        if (EQ (p->childp, Qt) && p->pid == pid)
            break;
          p = 0;
        }
        /* Look for an asynchronous process whose pid hasn't been filled
         in yet.  */
        if (p == 0)
 -      for (tail = Vprocess_alist; GC_CONSP (tail); tail = XCDR (tail))
 +      for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
          {
            proc = XCDR (XCAR (tail));
            p = XPROCESS (proc);
@@@ -6830,7 -6924,7 +6830,7 @@@ encode subprocess input.  */
      error ("Output file descriptor of %s closed", SDATA (p->name));
    Fcheck_coding_system (decoding);
    Fcheck_coding_system (encoding);
 -
 +  encoding = coding_inherit_eol_type (encoding, Qnil);
    p->decode_coding_system = decoding;
    p->encode_coding_system = encoding;
    setup_process_coding_systems (process);
@@@ -7249,7 -7343,7 +7249,7 @@@ The variable takes effect when `start-p
  
  #include "lisp.h"
  #include "systime.h"
 -#include "charset.h"
 +#include "character.h"
  #include "coding.h"
  #include "termopts.h"
  #include "sysselect.h"