all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#21707: include-file cleanup for src directory
@ 2015-10-19  7:05 Paul Eggert
  2015-10-19  7:23 ` Eli Zaretskii
  2015-10-21  1:38 ` Paul Eggert
  0 siblings, 2 replies; 13+ messages in thread
From: Paul Eggert @ 2015-10-19  7:05 UTC (permalink / raw)
  To: 21707

[-- Attachment #1: Type: text/plain, Size: 253 bytes --]

Tags: patch

Attached is a patch to remove unnecessary #include directives from the src 
directory, and add a few #include directives that should be there.  I'm not 
installing this now, to give Eli a heads-up in case this affects the MS-Windows 
port.

[-- Attachment #2: 0001-Include-file-cleanup-for-src-directory.txt --]
[-- Type: text/plain, Size: 49577 bytes --]

From ada796438ae0935e453ec7e28bb4663f9d49fb48 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon, 19 Oct 2015 00:00:49 -0700
Subject: [PATCH] Include-file cleanup for src directory
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Omit ‘#include "foo.h"’ unless the file really needs foo.h.
In a few cases, add ‘#include "foo.h"’ if the file needs foo.h
but does not include it directly.  As a general rule, a source
file should include foo.h if it needs the interfaces that foo.h
defines.
* src/alloc.c: Don’t include process.h.  Include dispextern.h,
systime.h.
* src/atimer.c: Don’t include blockinput.h.
* src/buffer.c: Include coding.h, systime.h.  Don’t include
keyboard.h, coding.h.
* src/callint.c: Don’t include commands.h, keymap.h.
* src/callproc.c: Don’t include character.h, ccl.h, composite.h,
systty.h, termhooks.h.
* src/casetab.c: Don’t include character.h.
* src/category.c: Don’t include charset.h, keymap.h.
* src/ccl.h: Don’t include character.h.
* src/character.c: Don’t include charset.h.
* src/charset.c: Don’t include disptab.h.
* src/chartab.c: Don’t include ccl.h.
* src/cm.c: Don’t include frame.h, termhooks.h.
* src/cmds.c: Don’t include window.h, dispextern.h.
* src/coding.c: Don’t include window.h, frame.h.
* src/composite.c: Include composite.h.  Don’t include window.h,
font.h.
* src/data.c: Don’t include syssignal.h, termhooks.h, font.h.
* src/dbusbind.c: Don’t include frame.h.
* src/decompress.c: Don’t include character.h.
* src/dired.c: Don’t include character.h, commands.h, charset.h.
* src/dispnew.c: Don’t include character.h, indent.h, intervals.h,
process.h, timespec.h.  Include systime.h.
* src/doc.c: Include coding.h.  Don’t include keyboard.h.
* src/editfns.c: Include composite.h.  Don’t include frame.h.
* src/emacs.c: Include fcntl.h, coding.h.  Don’t include
commands.h, systty.h..
* src/eval.c: Don’t include dispextern.h.
* src/fileio.c: Don’t include intervals.h, dispextern.h.
Include composite.h.
* src/filelock.c: Don’t include character.h, systime.h.
* src/fns.c: Don’t include time.h, commands.h, keyboard.h,
keymap.h, frame.h, blockinput.h, xterm.h.  Include composite.h.
* src/font.c: Include termhooks.h.
* src/font.h: Don’t include ccl.h, frame.h.  Add forward decls of
struct composition_it, struct face, struct glyph_string.
* src/fontset.c: Don’t include buffer.h, ccl.h, keyboard.h,
intervals.h, window.h, termhooks.h.
* src/frame.c: Don’t include character.h, commands.h, font.h.
* src/frame.h: Don’t include dispextern.h.
* src/fringe.c: Don’t include character.h.
* src/ftcrfont.c: Don’t include dispextern.h, frame.h,
character.h, charset.h, fontset.h.
* src/ftfont.c: Don’t include frame.h, blockinput.h, coding.h,
fontset.h.
* src/ftxfont.c: Don’t include dispextern.h, character.h,
charset.h, fontset.h.
* src/gfilenotify.c: Don’t include frame.h, process.h.
* src/gtkutil.c: Include dispextern.h, frame.h, systime.h.
Don’t include syssignal.h, buffer.h, charset.h, font.h.
* src/gtkutil.h: Don’t include frame.h.
* src/image.c: Include stdio.h instead of sysstdio.h.
Don’t include character.h.
* src/indent.c: Don’t include keyboard.h, termchar.h.
* src/inotify.c: Don’t include character.h, frame.h.
* src/insdel.c: Include composite.h.  Don’t include blockinput.h.
* src/intervals.c: Don’t include character.h, keyboard.h.
* src/intervals.h: Don’t include dispextern.h, composite.h.
* src/keyboard.c: Don’t include sysstdio.h, disptab.h, puresize.h.
Include coding.h.
* src/keyboard.h: Don’t incldue systime.h.
* src/keymap.c: Don’t include charset.h, frame.h.
* src/lread.c: Don’t include frame.h.  Include systime.h.
* src/macros.c: Don’t include commands.h, character.h, buffer.h.
* src/menu.c: Include character.h, coding.h.  Don’t include
dispextern.h.
* src/menu.h: Don’t include systime.h.
* src/minibuf.c: Don’t include commands.h, dispextern.h, syntax.h,
intervals.h, termhooks.h.
* src/print.c: Include coding.h.  Don’t include keyboard.h,
window.h, dispextern.h, termchar.h, termhooks.h, font.h.
Add forward decl of struct terminal.
* src/process.c: Don’t include termhooks.h, commands.h,
dispextern.h, composite.h.
* src/region-cache.c: Don’t include character.h.
* src/scroll.c: Don’t include keyboard.h, window.h.
* src/search.c: Don’t include category.h, commands.h.
* src/sound.c: Don’t include dispextern.h.
* src/syntax.c: Don’t include command.h, keymap.h.
* src/sysdep.c: Don’t include window.h, dispextern.h.
* src/systime.h: Use ‘#ifdef emacs’, not ‘#ifdef EMACS_LISP_H’,
* src/term.c: Don’t include systty.h, intervals.h, xterm.h.
* src/terminal.c: Include character.h.
Don’t include charset.h, coding.h.
* src/textprop.c: Don’t include character.h.
* src/undo.c: Don’t include character.h, commands.h, window.h.
* src/unexsol.c: Don’t include character.h, charset.h.
* src/widget.c: Include widget.h.  Don’t include keyboard.h,
window.h, dispextern.h, blockinput.h, character.h, font.h.
* src/widgetprv.h: Don’t include widget.h.
* src/window.c: Don’t include character.h, menu.h, intervals.h.
* src/xdisp.c: Include composite.h, systime.h.  Don’t include
macros.h, process.h.
* src/xfaces.c: Don’t include charset.h, keyboard.h, termhooks.h,
intervals.h.
* src/xfns.c: Don’t include menu.h, character.h, intervals.h,
epaths.h, fontset.h, systime.h, atimer.h, termchar.h.
* src/xfont.c: Don’t include dispextern.h, fontset.h, ccl.h.
* src/xftfont.c: Don’t include dispextern.h, character.h, fontset.h.
* src/xgselect.c: Don’t include timespec.h, frame.h.
Include systime.h.
* src/xgselect.h: Don’t include time.h.
Use a forward decl to struct timespec instead.
* src/xmenu.c: Don’t include keymap.h, character.h, charset.h,
dispextern.h.  Include systime.h.
* src/xml.c: Don’t include character.h.
* src/xrdb.c [USE_MOTIF]: Don’t include keyboard.h.
* src/xselect.c: Don’t include dispextern.h, character.h,
buffer.h, process.h.
* src/xsmfns.c: Don’t include systime.h, sysselect.h.
* src/xterm.c: Don’t include syssignal.h, charset.h, disptab.h,
intervals.h process.h, keymap.h, xgselect.h.  Include composite.h.
---
 src/alloc.c        |  3 ++-
 src/atimer.c       |  1 -
 src/buffer.c       |  5 ++---
 src/callint.c      |  2 --
 src/callproc.c     |  5 -----
 src/casetab.c      |  1 -
 src/category.c     |  2 --
 src/ccl.h          |  2 --
 src/character.c    |  1 -
 src/charset.c      |  1 -
 src/chartab.c      |  1 -
 src/cm.c           |  2 --
 src/cmds.c         |  2 --
 src/coding.c       |  2 --
 src/composite.c    |  3 +--
 src/data.c         |  3 ---
 src/dbusbind.c     |  1 -
 src/decompress.c   |  1 -
 src/dired.c        |  3 ---
 src/dispnew.c      |  7 +------
 src/doc.c          |  2 +-
 src/editfns.c      |  2 +-
 src/emacs.c        |  4 ++--
 src/eval.c         |  1 -
 src/fileio.c       |  3 +--
 src/filelock.c     |  2 --
 src/fns.c          | 11 +----------
 src/font.c         |  1 +
 src/font.h         |  5 +++--
 src/fontset.c      |  6 ------
 src/frame.c        |  3 ---
 src/frame.h        |  5 -----
 src/fringe.c       |  1 -
 src/ftcrfont.c     |  5 -----
 src/ftfont.c       |  4 ----
 src/ftxfont.c      |  4 ----
 src/gfilenotify.c  |  2 --
 src/gtkutil.c      |  8 +++-----
 src/gtkutil.h      |  1 -
 src/image.c        |  3 +--
 src/indent.c       |  2 --
 src/inotify.c      |  2 --
 src/insdel.c       |  2 +-
 src/intervals.c    |  2 --
 src/intervals.h    |  4 ----
 src/keyboard.c     |  4 +---
 src/keyboard.h     |  1 -
 src/keymap.c       |  2 --
 src/lread.c        |  2 +-
 src/macros.c       |  3 ---
 src/menu.c         |  3 ++-
 src/menu.h         |  1 -
 src/minibuf.c      |  5 -----
 src/print.c        |  9 +++------
 src/process.c      |  4 ----
 src/region-cache.c |  1 -
 src/scroll.c       |  2 --
 src/search.c       |  2 --
 src/sound.c        |  1 -
 src/syntax.c       |  3 ---
 src/sysdep.c       |  4 +---
 src/systime.h      |  4 ++--
 src/term.c         |  6 ------
 src/terminal.c     |  3 +--
 src/textprop.c     |  1 -
 src/undo.c         |  3 ---
 src/unexsol.c      |  2 --
 src/widget.c       | 12 ++----------
 src/widgetprv.h    |  1 -
 src/window.c       |  3 ---
 src/xdisp.c        |  4 ++--
 src/xfaces.c       |  4 ----
 src/xfns.c         |  8 --------
 src/xfont.c        |  3 ---
 src/xftfont.c      |  3 ---
 src/xgselect.c     |  3 +--
 src/xgselect.h     |  3 ++-
 src/xmenu.c        |  6 +-----
 src/xml.c          |  1 -
 src/xrdb.c         |  5 -----
 src/xselect.c      |  4 ----
 src/xsmfns.c       |  2 --
 src/xterm.c        | 11 +----------
 83 files changed, 41 insertions(+), 231 deletions(-)

diff --git a/src/alloc.c b/src/alloc.c
index f08a350..7c33687 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -32,9 +32,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif
 
 #include "lisp.h"
-#include "process.h"
+#include "dispextern.h"
 #include "intervals.h"
 #include "puresize.h"
+#include "systime.h"
 #include "character.h"
 #include "buffer.h"
 #include "window.h"
diff --git a/src/atimer.c b/src/atimer.c
index 8a1a48b..976b990 100644
--- a/src/atimer.c
+++ b/src/atimer.c
@@ -22,7 +22,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "lisp.h"
 #include "syssignal.h"
 #include "systime.h"
-#include "blockinput.h"
 #include "atimer.h"
 #include <unistd.h>
 
diff --git a/src/buffer.c b/src/buffer.c
index 38ee74d..380a7af 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -30,7 +30,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <verify.h>
 
 #include "lisp.h"
+#include "coding.h"
 #include "intervals.h"
+#include "systime.h"
 #include "window.h"
 #include "commands.h"
 #include "character.h"
@@ -38,7 +40,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "region-cache.h"
 #include "indent.h"
 #include "blockinput.h"
-#include "keyboard.h"
 #include "keymap.h"
 #include "frame.h"
 
@@ -4573,8 +4574,6 @@ evaporate_overlays (ptrdiff_t pos)
 #include <fcntl.h>
 #endif
 
-#include "coding.h"
-
 
 /* Memory is allocated in regions which are mapped using mmap(2).
    The current implementation lets the system select mapped
diff --git a/src/callint.c b/src/callint.c
index 12d116d..76ee13e 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -23,10 +23,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "lisp.h"
 #include "character.h"
 #include "buffer.h"
-#include "commands.h"
 #include "keyboard.h"
 #include "window.h"
-#include "keymap.h"
 
 static Lisp_Object preserved_fns;
 
diff --git a/src/callproc.c b/src/callproc.c
index e38844e..eafd621 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -44,19 +44,14 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif /* MSDOS */
 
 #include "commands.h"
-#include "character.h"
 #include "buffer.h"
-#include "ccl.h"
 #include "coding.h"
-#include "composite.h"
 #include <epaths.h>
 #include "process.h"
 #include "syssignal.h"
-#include "systty.h"
 #include "syswait.h"
 #include "blockinput.h"
 #include "frame.h"
-#include "termhooks.h"
 
 #ifdef MSDOS
 #include "msdos.h"
diff --git a/src/casetab.c b/src/casetab.c
index b086abc..28da885 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -21,7 +21,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 
 #include "lisp.h"
-#include "character.h"
 #include "buffer.h"
 
 Lisp_Object Vascii_downcase_table;
diff --git a/src/category.c b/src/category.c
index 400116f..5c7cf07 100644
--- a/src/category.c
+++ b/src/category.c
@@ -33,9 +33,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "lisp.h"
 #include "character.h"
 #include "buffer.h"
-#include "charset.h"
 #include "category.h"
-#include "keymap.h"
 
 /* This setter is used only in this file, so it can be private.  */
 static void
diff --git a/src/ccl.h b/src/ccl.h
index 7b72dc7..fdce437 100644
--- a/src/ccl.h
+++ b/src/ccl.h
@@ -26,8 +26,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef EMACS_CCL_H
 #define EMACS_CCL_H
 
-#include "character.h" /* For MAX_MULTIBYTE_LENGTH */
-
 /* Macros for exit status of CCL program.  */
 #define CCL_STAT_SUCCESS	0 /* Terminated successfully.  */
 #define CCL_STAT_SUSPEND_BY_SRC	1 /* Terminated by empty input.  */
diff --git a/src/character.c b/src/character.c
index f51d971..3e2bf1e 100644
--- a/src/character.c
+++ b/src/character.c
@@ -38,7 +38,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "lisp.h"
 #include "character.h"
 #include "buffer.h"
-#include "charset.h"
 #include "composite.h"
 #include "disptab.h"
 
diff --git a/src/charset.c b/src/charset.c
index eeebf17..04e81bb 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -38,7 +38,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "character.h"
 #include "charset.h"
 #include "coding.h"
-#include "disptab.h"
 #include "buffer.h"
 
 /*** GENERAL NOTES on CODED CHARACTER SETS (CHARSETS) ***
diff --git a/src/chartab.c b/src/chartab.c
index 274bb60..ec618f3 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -23,7 +23,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "lisp.h"
 #include "character.h"
 #include "charset.h"
-#include "ccl.h"
 
 /* 64/16/32/128 */
 
diff --git a/src/cm.c b/src/cm.c
index 474f280..f0aa56d 100644
--- a/src/cm.c
+++ b/src/cm.c
@@ -22,9 +22,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdio.h>
 
 #include "lisp.h"
-#include "frame.h"
 #include "cm.h"
-#include "termhooks.h"
 #include "termchar.h"
 #include "tparam.h"
 
diff --git a/src/cmds.c b/src/cmds.c
index 39c5af9..0afc023 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -25,10 +25,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "character.h"
 #include "buffer.h"
 #include "syntax.h"
-#include "window.h"
 #include "keyboard.h"
 #include "keymap.h"
-#include "dispextern.h"
 #include "frame.h"
 
 static int internal_self_insert (int, EMACS_INT);
diff --git a/src/coding.c b/src/coding.c
index c5099a7..0b42a36 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -297,8 +297,6 @@ encode_coding_XXX (struct coding_system *coding)
 #include "ccl.h"
 #include "composite.h"
 #include "coding.h"
-#include "window.h"
-#include "frame.h"
 #include "termhooks.h"
 
 Lisp_Object Vcoding_system_hash_table;
diff --git a/src/composite.c b/src/composite.c
index 88cef22..0f729bc 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -26,13 +26,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "character.h"
+#include "composite.h"
 #include "buffer.h"
 #include "coding.h"
 #include "intervals.h"
-#include "window.h"
 #include "frame.h"
 #include "dispextern.h"
-#include "font.h"
 #include "termhooks.h"
 
 
diff --git a/src/data.c b/src/data.c
index b85d8a7..f5ff5d9 100644
--- a/src/data.c
+++ b/src/data.c
@@ -32,9 +32,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "buffer.h"
 #include "keyboard.h"
 #include "frame.h"
-#include "syssignal.h"
-#include "termhooks.h"  /* For FRAME_KBOARD reference in y-or-n-p.  */
-#include "font.h"
 #include "keymap.h"
 
 static void swap_in_symval_forwarding (struct Lisp_Symbol *,
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 181c7d0..ce0465d 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -23,7 +23,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <dbus/dbus.h>
 
 #include "lisp.h"
-#include "frame.h"
 #include "termhooks.h"
 #include "keyboard.h"
 #include "process.h"
diff --git a/src/decompress.c b/src/decompress.c
index 460d4fe..d0c0018 100644
--- a/src/decompress.c
+++ b/src/decompress.c
@@ -23,7 +23,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <zlib.h>
 
 #include "lisp.h"
-#include "character.h"
 #include "buffer.h"
 
 #include <verify.h>
diff --git a/src/dired.c b/src/dired.c
index 3486e49..84bf247 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -39,10 +39,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "systime.h"
-#include "character.h"
 #include "buffer.h"
-#include "commands.h"
-#include "charset.h"
 #include "coding.h"
 #include "regex.h"
 #include "blockinput.h"
diff --git a/src/dispnew.c b/src/dispnew.c
index 00d086e..18eed3c 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -28,7 +28,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* cm.h must come after dispextern.h on Windows.  */
 #include "dispextern.h"
 #include "cm.h"
-#include "character.h"
 #include "buffer.h"
 #include "keyboard.h"
 #include "frame.h"
@@ -36,12 +35,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "window.h"
 #include "commands.h"
 #include "disptab.h"
-#include "indent.h"
-#include "intervals.h"
 #include "blockinput.h"
-#include "process.h"
-
 #include "syssignal.h"
+#include "systime.h"
 #include "tparam.h"
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -51,7 +47,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <errno.h>
 
 #include <fpending.h>
-#include <timespec.h>
 
 #ifdef WINDOWSNT
 #include "w32.h"
diff --git a/src/doc.c b/src/doc.c
index 68d4367..694c159 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -31,9 +31,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "character.h"
+#include "coding.h"
 #include "buffer.h"
 #include "disptab.h"
-#include "keyboard.h"
 #include "keymap.h"
 
 /* Buffer used for reading from documentation file.  */
diff --git a/src/editfns.c b/src/editfns.c
index 12e5ca8..050eb2a 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -52,11 +52,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <strftime.h>
 #include <verify.h>
 
+#include "composite.h"
 #include "intervals.h"
 #include "character.h"
 #include "buffer.h"
 #include "coding.h"
-#include "frame.h"
 #include "window.h"
 #include "blockinput.h"
 
diff --git a/src/emacs.c b/src/emacs.c
index 3eff5a7..b4052b8 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -22,6 +22,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 
 #include <errno.h>
+#include <fcntl.h>
 #include <stdio.h>
 
 #include <sys/types.h>
@@ -59,13 +60,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include TERM_HEADER
 #endif /* HAVE_WINDOW_SYSTEM */
 
-#include "commands.h"
+#include "coding.h"
 #include "intervals.h"
 #include "character.h"
 #include "buffer.h"
 #include "window.h"
 
-#include "systty.h"
 #include "atimer.h"
 #include "blockinput.h"
 #include "syssignal.h"
diff --git a/src/eval.c b/src/eval.c
index ac98ca1..3f9e624 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -26,7 +26,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "blockinput.h"
 #include "commands.h"
 #include "keyboard.h"
-#include "dispextern.h"
 #include "buffer.h"
 
 /* Chain of condition and catch handlers currently in effect.  */
diff --git a/src/fileio.c b/src/fileio.c
index 3155ef0..428093b 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -43,7 +43,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <c-ctype.h>
 
 #include "lisp.h"
-#include "intervals.h"
+#include "composite.h"
 #include "character.h"
 #include "buffer.h"
 #include "coding.h"
@@ -51,7 +51,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "blockinput.h"
 #include "region-cache.h"
 #include "frame.h"
-#include "dispextern.h"
 
 #ifdef WINDOWSNT
 #define NOMINMAX 1
diff --git a/src/filelock.c b/src/filelock.c
index cad6f83..7f9b6e7 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -45,10 +45,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <c-ctype.h>
 
 #include "lisp.h"
-#include "character.h"
 #include "buffer.h"
 #include "coding.h"
-#include "systime.h"
 #ifdef WINDOWSNT
 #include <share.h>
 #include <sys/socket.h>	/* for fcntl */
diff --git a/src/fns.c b/src/fns.c
index dfd48a2..f545066 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -21,25 +21,16 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 
 #include <unistd.h>
-#include <time.h>
-
 #include <intprops.h>
 #include <vla.h>
 
 #include "lisp.h"
-#include "commands.h"
 #include "character.h"
 #include "coding.h"
+#include "composite.h"
 #include "buffer.h"
-#include "keyboard.h"
-#include "keymap.h"
 #include "intervals.h"
-#include "frame.h"
 #include "window.h"
-#include "blockinput.h"
-#if defined (HAVE_X_WINDOWS)
-#include "xterm.h"
-#endif
 
 static void sort_vector_copy (Lisp_Object, ptrdiff_t,
 			      Lisp_Object [restrict], Lisp_Object [restrict]);
diff --git a/src/font.c b/src/font.c
index a52a653..25fb3e9 100644
--- a/src/font.c
+++ b/src/font.c
@@ -36,6 +36,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "composite.h"
 #include "fontset.h"
 #include "font.h"
+#include "termhooks.h"
 
 #ifdef HAVE_WINDOW_SYSTEM
 #include TERM_HEADER
diff --git a/src/font.h b/src/font.h
index 43e67e9..1d13e1c 100644
--- a/src/font.h
+++ b/src/font.h
@@ -22,8 +22,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef EMACS_FONT_H
 #define EMACS_FONT_H
 
-#include "ccl.h"
-#include "frame.h"
+struct composition_it;
+struct face;
+struct glyph_string;
 
 INLINE_HEADER_BEGIN
 
diff --git a/src/fontset.c b/src/fontset.c
index e735989..9429d79 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -30,19 +30,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "lisp.h"
 #include "blockinput.h"
 #include "character.h"
-#include "buffer.h"
 #include "charset.h"
-#include "ccl.h"
-#include "keyboard.h"
 #include "frame.h"
 #include "dispextern.h"
-#include "intervals.h"
 #include "fontset.h"
-#include "window.h"
 #ifdef HAVE_WINDOW_SYSTEM
 #include TERM_HEADER
 #endif /* HAVE_WINDOW_SYSTEM */
-#include "termhooks.h"
 #include "font.h"
 
 /* FONTSET
diff --git a/src/frame.c b/src/frame.c
index 6d596a4..78f8ff7 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -26,7 +26,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <c-ctype.h>
 
 #include "lisp.h"
-#include "character.h"
 
 #ifdef HAVE_WINDOW_SYSTEM
 #include TERM_HEADER
@@ -34,7 +33,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "buffer.h"
 /* These help us bind and responding to switch-frame events.  */
-#include "commands.h"
 #include "keyboard.h"
 #include "frame.h"
 #include "blockinput.h"
@@ -42,7 +40,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "termhooks.h"
 #include "dispextern.h"
 #include "window.h"
-#include "font.h"
 #ifdef HAVE_WINDOW_SYSTEM
 #include "fontset.h"
 #endif
diff --git a/src/frame.h b/src/frame.h
index acac514..e7d3aab 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -16,14 +16,9 @@ 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/>.  */
 
-/* Don't multiply include: dispextern.h includes macterm.h which
-   includes frame.h some emacs source includes both dispextern.h and
-   frame.h.  */
-
 #ifndef EMACS_FRAME_H
 #define EMACS_FRAME_H
 
-#include "dispextern.h"
 #include "termhooks.h"
 #include "window.h"
 
diff --git a/src/fringe.c b/src/fringe.c
index fcc5207..632fa0b 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -26,7 +26,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "frame.h"
 #include "window.h"
 #include "dispextern.h"
-#include "character.h"
 #include "buffer.h"
 #include "blockinput.h"
 #include "termhooks.h"
diff --git a/src/ftcrfont.c b/src/ftcrfont.c
index df3aa59..4326b77 100644
--- a/src/ftcrfont.c
+++ b/src/ftcrfont.c
@@ -22,13 +22,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <cairo-ft.h>
 
 #include "lisp.h"
-#include "dispextern.h"
 #include "xterm.h"
-#include "frame.h"
 #include "blockinput.h"
-#include "character.h"
-#include "charset.h"
-#include "fontset.h"
 #include "font.h"
 #include "ftfont.h"
 
diff --git a/src/ftfont.c b/src/ftfont.c
index 15a8159..fb1addb 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -28,13 +28,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "dispextern.h"
-#include "frame.h"
-#include "blockinput.h"
 #include "character.h"
 #include "charset.h"
-#include "coding.h"
 #include "composite.h"
-#include "fontset.h"
 #include "font.h"
 #include "ftfont.h"
 
diff --git a/src/ftxfont.c b/src/ftxfont.c
index cd2bf3e..99b06f2 100644
--- a/src/ftxfont.c
+++ b/src/ftxfont.c
@@ -24,13 +24,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <X11/Xlib.h>
 
 #include "lisp.h"
-#include "dispextern.h"
 #include "xterm.h"
 #include "frame.h"
 #include "blockinput.h"
-#include "character.h"
-#include "charset.h"
-#include "fontset.h"
 #include "font.h"
 
 /* FTX font driver.  */
diff --git a/src/gfilenotify.c b/src/gfilenotify.c
index 69f635d..2057f88 100644
--- a/src/gfilenotify.c
+++ b/src/gfilenotify.c
@@ -23,10 +23,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <gio/gio.h>
 #include "lisp.h"
 #include "coding.h"
-#include "frame.h"
 #include "termhooks.h"
 #include "keyboard.h"
-#include "process.h"
 
 \f
 /* This is a list, elements are triples (DESCRIPTOR FILE FLAGS CALLBACK)  */
diff --git a/src/gtkutil.c b/src/gtkutil.c
index ad71b9c..701bcab 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -26,20 +26,18 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <c-ctype.h>
 
 #include "lisp.h"
+#include "dispextern.h"
+#include "frame.h"
+#include "systime.h"
 #include "xterm.h"
 #include "blockinput.h"
-#include "syssignal.h"
 #include "window.h"
-#include "buffer.h"
 #include "gtkutil.h"
 #include "termhooks.h"
 #include "keyboard.h"
-#include "charset.h"
 #include "coding.h"
-#include "font.h"
 
 #include <gdk/gdkkeysyms.h>
-#include "xsettings.h"
 
 #ifdef HAVE_XFT
 #include <X11/Xft/Xft.h>
diff --git a/src/gtkutil.h b/src/gtkutil.h
index 34338db..0dbb4a1 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -25,7 +25,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <gtk/gtk.h>
 #include "../lwlib/lwlib-widget.h"
-#include "frame.h"
 #include "xterm.h"
 
 /* Minimum and maximum values used for GTK scroll bars  */
diff --git a/src/image.c b/src/image.c
index c702782..e62461d 100644
--- a/src/image.c
+++ b/src/image.c
@@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
-#include "sysstdio.h"
+#include <stdio.h>
 #include <unistd.h>
 
 /* Include this before including <setjmp.h> to work around bugs with
@@ -38,7 +38,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "blockinput.h"
 #include "systime.h"
 #include <epaths.h>
-#include "character.h"
 #include "coding.h"
 #include "termhooks.h"
 #include "font.h"
diff --git a/src/indent.c b/src/indent.c
index 330065b..04837f8 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -26,10 +26,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "category.h"
 #include "composite.h"
 #include "indent.h"
-#include "keyboard.h"
 #include "frame.h"
 #include "window.h"
-#include "termchar.h"
 #include "disptab.h"
 #include "intervals.h"
 #include "dispextern.h"
diff --git a/src/inotify.c b/src/inotify.c
index be8c1dd..d1a80bb 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -25,8 +25,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "coding.h"
 #include "process.h"
 #include "keyboard.h"
-#include "character.h"
-#include "frame.h" /* Required for termhooks.h.  */
 #include "termhooks.h"
 
 #include <errno.h>
diff --git a/src/insdel.c b/src/insdel.c
index a977b79..24807b1 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -23,11 +23,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <intprops.h>
 
 #include "lisp.h"
+#include "composite.h"
 #include "intervals.h"
 #include "character.h"
 #include "buffer.h"
 #include "window.h"
-#include "blockinput.h"
 #include "region-cache.h"
 
 static void insert_from_string_1 (Lisp_Object, ptrdiff_t, ptrdiff_t, ptrdiff_t,
diff --git a/src/intervals.c b/src/intervals.c
index 1c8dd41..c272bae 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -43,10 +43,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <intprops.h>
 #include "lisp.h"
 #include "intervals.h"
-#include "character.h"
 #include "buffer.h"
 #include "puresize.h"
-#include "keyboard.h"
 #include "keymap.h"
 
 /* Test for membership, allowing for t (actually any non-cons) to mean the
diff --git a/src/intervals.h b/src/intervals.h
index 5a7829d..96e8205 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -19,8 +19,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef EMACS_INTERVALS_H
 #define EMACS_INTERVALS_H
 
-#include "dispextern.h"
-
 INLINE_HEADER_BEGIN
 
 /* Basic data type for use of intervals.  */
@@ -295,8 +293,6 @@ extern int text_property_stickiness (Lisp_Object prop, Lisp_Object pos,
 
 extern void syms_of_textprop (void);
 
-#include "composite.h"
-
 INLINE_HEADER_END
 
 #endif /* EMACS_INTERVALS_H */
diff --git a/src/keyboard.c b/src/keyboard.c
index 966af69..1a78f6a 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -20,10 +20,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
-#include "sysstdio.h"
 #include <sys/stat.h>
 
 #include "lisp.h"
+#include "coding.h"
 #include "termchar.h"
 #include "termopts.h"
 #include "frame.h"
@@ -34,13 +34,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "commands.h"
 #include "character.h"
 #include "buffer.h"
-#include "disptab.h"
 #include "dispextern.h"
 #include "syntax.h"
 #include "intervals.h"
 #include "keymap.h"
 #include "blockinput.h"
-#include "puresize.h"
 #include "systime.h"
 #include "atimer.h"
 #include "process.h"
diff --git a/src/keyboard.h b/src/keyboard.h
index 67afc3b..98bc86b 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -20,7 +20,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef EMACS_KEYBOARD_H
 #define EMACS_KEYBOARD_H
 
-#include "systime.h"		/* for struct timespec, Time */
 #include "coding.h"             /* for ENCODE_UTF_8 and ENCODE_SYSTEM */
 #include "termhooks.h"
 
diff --git a/src/keymap.c b/src/keymap.c
index 81091f0..c988d12 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -46,9 +46,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "commands.h"
 #include "character.h"
 #include "buffer.h"
-#include "charset.h"
 #include "keyboard.h"
-#include "frame.h"
 #include "termhooks.h"
 #include "blockinput.h"
 #include "puresize.h"
diff --git a/src/lread.c b/src/lread.c
index bceec4b..9a0b80a 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -39,7 +39,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <epaths.h>
 #include "commands.h"
 #include "keyboard.h"
-#include "frame.h"
+#include "systime.h"
 #include "termhooks.h"
 #include "blockinput.h"
 
diff --git a/src/macros.c b/src/macros.c
index 1bf2cd7..d963838 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -22,9 +22,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "macros.h"
-#include "commands.h"
-#include "character.h"
-#include "buffer.h"
 #include "window.h"
 #include "keyboard.h"
 
diff --git a/src/menu.c b/src/menu.c
index dc82809..74df43f 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -23,13 +23,14 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <limits.h> /* for INT_MAX */
 
 #include "lisp.h"
+#include "character.h"
+#include "coding.h"
 #include "keyboard.h"
 #include "keymap.h"
 #include "frame.h"
 #include "window.h"
 #include "termhooks.h"
 #include "blockinput.h"
-#include "dispextern.h"
 #include "buffer.h"
 
 #ifdef USE_X_TOOLKIT
diff --git a/src/menu.h b/src/menu.h
index de586a5..e89e93e 100644
--- a/src/menu.h
+++ b/src/menu.h
@@ -19,7 +19,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef MENU_H
 #define MENU_H
 
-#include "systime.h" /* for Time */
 #include "../lwlib/lwlib-widget.h"
 
 /* Bit fields used by terminal-specific menu_show_hook.  */
diff --git a/src/minibuf.c b/src/minibuf.c
index e149e81..31b6946 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -25,17 +25,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <binary-io.h>
 
 #include "lisp.h"
-#include "commands.h"
 #include "character.h"
 #include "buffer.h"
-#include "dispextern.h"
 #include "keyboard.h"
 #include "frame.h"
 #include "window.h"
-#include "syntax.h"
-#include "intervals.h"
 #include "keymap.h"
-#include "termhooks.h"
 #include "systty.h"
 
 /* List of buffers for use as minibuffers.
diff --git a/src/print.c b/src/print.c
index 3c3dca7..6f868ce 100644
--- a/src/print.c
+++ b/src/print.c
@@ -24,24 +24,21 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "character.h"
+#include "coding.h"
 #include "buffer.h"
 #include "charset.h"
-#include "keyboard.h"
 #include "frame.h"
-#include "window.h"
 #include "process.h"
-#include "dispextern.h"
 #include "disptab.h"
-#include "termchar.h"
 #include "intervals.h"
 #include "blockinput.h"
-#include "termhooks.h"		/* For struct terminal.  */
-#include "font.h"
 
 #include <c-ctype.h>
 #include <float.h>
 #include <ftoastr.h>
 
+struct terminal;
+
 /* Avoid actual stack overflow in print.  */
 static ptrdiff_t print_depth;
 
diff --git a/src/process.c b/src/process.c
index 55f31a0..dc93b86 100644
--- a/src/process.c
+++ b/src/process.c
@@ -103,13 +103,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "coding.h"
 #include "process.h"
 #include "frame.h"
-#include "termhooks.h"
 #include "termopts.h"
-#include "commands.h"
 #include "keyboard.h"
 #include "blockinput.h"
-#include "dispextern.h"
-#include "composite.h"
 #include "atimer.h"
 #include "sysselect.h"
 #include "syssignal.h"
diff --git a/src/region-cache.c b/src/region-cache.c
index 937f3d0..1383acd 100644
--- a/src/region-cache.c
+++ b/src/region-cache.c
@@ -23,7 +23,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdio.h>
 
 #include "lisp.h"
-#include "character.h"
 #include "buffer.h"
 #include "region-cache.h"
 
diff --git a/src/scroll.c b/src/scroll.c
index 7f5b73b..2534ab0 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -25,9 +25,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "lisp.h"
 #include "termchar.h"
 #include "dispextern.h"
-#include "keyboard.h"
 #include "frame.h"
-#include "window.h"
 #include "termhooks.h"
 
 /* All costs measured in characters.
diff --git a/src/search.c b/src/search.c
index 8c9714e..e39ba3d 100644
--- a/src/search.c
+++ b/src/search.c
@@ -22,13 +22,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 
 #include "lisp.h"
-#include "category.h"
 #include "character.h"
 #include "buffer.h"
 #include "syntax.h"
 #include "charset.h"
 #include "region-cache.h"
-#include "commands.h"
 #include "blockinput.h"
 #include "intervals.h"
 
diff --git a/src/sound.c b/src/sound.c
index 9a365c7..09ab48c 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -46,7 +46,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <errno.h>
 
 #include "lisp.h"
-#include "dispextern.h"
 #include "atimer.h"
 #include "syssignal.h"
 /* END: Common Includes */
diff --git a/src/syntax.c b/src/syntax.c
index 6bfb3b7..1dcb3a5 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -23,12 +23,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <sys/types.h>
 
 #include "lisp.h"
-#include "commands.h"
 #include "character.h"
 #include "buffer.h"
-#include "keymap.h"
 #include "regex.h"
-
 #include "syntax.h"
 #include "intervals.h"
 #include "category.h"
diff --git a/src/sysdep.c b/src/sysdep.c
index 836cc27..1af323e 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -93,13 +93,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "keyboard.h"
 #include "frame.h"
-#include "window.h"
 #include "termhooks.h"
 #include "termchar.h"
 #include "termopts.h"
-#include "dispextern.h"
 #include "process.h"
-#include "cm.h"  /* for reset_sys_modes */
+#include "cm.h"
 
 #ifdef WINDOWSNT
 #include <direct.h>
diff --git a/src/systime.h b/src/systime.h
index 315f9d1..a7c182a 100644
--- a/src/systime.h
+++ b/src/systime.h
@@ -83,8 +83,8 @@ extern struct timeval make_timeval (struct timespec) ATTRIBUTE_CONST;
 extern void set_waiting_for_input (struct timespec *);
 
 /* When lisp.h is not included Lisp_Object is not defined (this can
-   happen when this files is used outside the src directory).  */
-#ifdef EMACS_LISP_H
+   happen when this file is used outside the src directory).  */
+#ifdef emacs
 
 /* Emacs uses the integer list (HI LO US PS) to represent the time
    (HI << LO_TIME_BITS) + LO + US / 1e6 + PS / 1e12.  */
diff --git a/src/term.c b/src/term.c
index 5acc473..9b1e7ca 100644
--- a/src/term.c
+++ b/src/term.c
@@ -44,8 +44,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "keymap.h"
 #include "blockinput.h"
 #include "syssignal.h"
-#include "systty.h"
-#include "intervals.h"
 #ifdef MSDOS
 #include "msdos.h"
 static int been_here = -1;
@@ -56,10 +54,6 @@ static int been_here = -1;
 #endif
 
 #include "cm.h"
-#ifdef HAVE_X_WINDOWS
-#include "xterm.h"
-#endif
-
 #include "menu.h"
 
 /* The name of the default console device.  */
diff --git a/src/terminal.c b/src/terminal.c
index 80c6aa2..27594e5 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -21,11 +21,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdio.h>
 
 #include "lisp.h"
+#include "character.h"
 #include "frame.h"
 #include "termchar.h"
 #include "termhooks.h"
-#include "charset.h"
-#include "coding.h"
 #include "keyboard.h"
 
 #if HAVE_STRUCT_UNIPAIR_UNICODE
diff --git a/src/textprop.c b/src/textprop.c
index 6758d4d..1995ff6 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -21,7 +21,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "intervals.h"
-#include "character.h"
 #include "buffer.h"
 #include "window.h"
 
diff --git a/src/undo.c b/src/undo.c
index 750bc8a..e0924b2 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -21,10 +21,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 
 #include "lisp.h"
-#include "character.h"
 #include "buffer.h"
-#include "commands.h"
-#include "window.h"
 
 /* Last buffer for which undo information was recorded.  */
 /* BEWARE: This is not traced by the GC, so never dereference it!  */
diff --git a/src/unexsol.c b/src/unexsol.c
index cfd515f..0f84099 100644
--- a/src/unexsol.c
+++ b/src/unexsol.c
@@ -6,9 +6,7 @@
 #include <dlfcn.h>
 
 #include "lisp.h"
-#include "character.h"
 #include "buffer.h"
-#include "charset.h"
 #include "coding.h"
 
 void
diff --git a/src/widget.c b/src/widget.c
index 48872f5..d0c3e60 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -29,17 +29,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    */
 
 #include <config.h>
+#include "widget.h"
+
 #include <stdio.h>
 
 #include "lisp.h"
 #include "xterm.h"
-
-#include "keyboard.h"
 #include "frame.h"
-#include "window.h"
-
-#include "dispextern.h"
-#include "blockinput.h"
 
 #include <X11/StringDefs.h>
 #include <X11/IntrinsicP.h>
@@ -50,10 +46,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <X11/ShellP.h>
 #include "../lwlib/lwlib.h"
 
-#include "character.h"
-#include "font.h"
-
-
 static void EmacsFrameInitialize (Widget request, Widget new, ArgList dum1, Cardinal *dum2);
 static void EmacsFrameDestroy (Widget widget);
 static void EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs);
diff --git a/src/widgetprv.h b/src/widgetprv.h
index 6cbbbd6..dc01248 100644
--- a/src/widgetprv.h
+++ b/src/widgetprv.h
@@ -23,7 +23,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <X11/IntrinsicP.h>
 #include <X11/CoreP.h>
-#include "widget.h"
 
 typedef struct {
   struct frame*	frame;		/* the *emacs* frame object */
diff --git a/src/window.c b/src/window.c
index 3566f6e..8ed0f32 100644
--- a/src/window.c
+++ b/src/window.c
@@ -23,11 +23,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdio.h>
 
 #include "lisp.h"
-#include "character.h"
 #include "buffer.h"
 #include "keyboard.h"
 #include "keymap.h"
-#include "menu.h"
 #include "frame.h"
 #include "window.h"
 #include "commands.h"
@@ -36,7 +34,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "disptab.h"
 #include "dispextern.h"
 #include "blockinput.h"
-#include "intervals.h"
 #include "termhooks.h"		/* For FRAME_TERMINAL.  */
 #ifdef HAVE_WINDOW_SYSTEM
 #include TERM_HEADER
diff --git a/src/xdisp.c b/src/xdisp.c
index 986e13f..bfd3a82 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -292,7 +292,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "atimer.h"
+#include "composite.h"
 #include "keyboard.h"
+#include "systime.h"
 #include "frame.h"
 #include "window.h"
 #include "termchar.h"
@@ -303,13 +305,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "indent.h"
 #include "commands.h"
 #include "keymap.h"
-#include "macros.h"
 #include "disptab.h"
 #include "termhooks.h"
 #include "termopts.h"
 #include "intervals.h"
 #include "coding.h"
-#include "process.h"
 #include "region-cache.h"
 #include "font.h"
 #include "fontset.h"
diff --git a/src/xfaces.c b/src/xfaces.c
index a3d122f..6bbd541 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -206,10 +206,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "character.h"
-#include "charset.h"
-#include "keyboard.h"
 #include "frame.h"
-#include "termhooks.h"
 
 #ifdef USE_MOTIF
 #include <Xm/Xm.h>
@@ -237,7 +234,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "dispextern.h"
 #include "blockinput.h"
 #include "window.h"
-#include "intervals.h"
 #include "termchar.h"
 
 #include "font.h"
diff --git a/src/xfns.c b/src/xfns.c
index 8251f93..db87fcc 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -24,23 +24,15 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "xterm.h"
-#include "menu.h"
 #include "frame.h"
 #include "window.h"
-#include "character.h"
 #include "buffer.h"
-#include "intervals.h"
 #include "dispextern.h"
 #include "keyboard.h"
 #include "blockinput.h"
-#include <epaths.h>
 #include "charset.h"
 #include "coding.h"
-#include "fontset.h"
-#include "systime.h"
 #include "termhooks.h"
-#include "atimer.h"
-#include "termchar.h"
 #include "font.h"
 
 #include <sys/types.h>
diff --git a/src/xfont.c b/src/xfont.c
index d5a7d64..671b105 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -24,15 +24,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <X11/Xlib.h>
 
 #include "lisp.h"
-#include "dispextern.h"
 #include "xterm.h"
 #include "frame.h"
 #include "blockinput.h"
 #include "character.h"
 #include "charset.h"
-#include "fontset.h"
 #include "font.h"
-#include "ccl.h"
 
 \f
 /* X core font driver.  */
diff --git a/src/xftfont.c b/src/xftfont.c
index 851edb6..956231e 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -25,14 +25,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <X11/Xft/Xft.h>
 
 #include "lisp.h"
-#include "dispextern.h"
 #include "xterm.h"
 #include "frame.h"
 #include "blockinput.h"
-#include "character.h"
 #include "charset.h"
 #include "composite.h"
-#include "fontset.h"
 #include "font.h"
 #include "ftfont.h"
 
diff --git a/src/xgselect.c b/src/xgselect.c
index 0b62d3e..55e1ffc 100644
--- a/src/xgselect.c
+++ b/src/xgselect.c
@@ -26,9 +26,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <glib.h>
 #include <errno.h>
 #include <stdbool.h>
-#include <timespec.h>
-#include "frame.h"
 #include "blockinput.h"
+#include "systime.h"
 
 /* `xg_select' is a `pselect' replacement.  Why do we need a separate function?
    1. Timeouts.  Glib and Gtk rely on timer events.  If we did pselect
diff --git a/src/xgselect.h b/src/xgselect.h
index ada2376..524fff7 100644
--- a/src/xgselect.h
+++ b/src/xgselect.h
@@ -21,9 +21,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define XGSELECT_H
 
 #include "lisp.h"
-#include <time.h>
 #include "sysselect.h"
 
+struct timespec;
+
 extern int xg_select (int max_fds,
 		      fd_set *rfds, fd_set *wfds, fd_set *efds,
 		      struct timespec const *timeout,
diff --git a/src/xmenu.c b/src/xmenu.c
index 4379cdd..be6e41d 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -36,14 +36,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "keyboard.h"
-#include "keymap.h"
 #include "frame.h"
+#include "systime.h"
 #include "termhooks.h"
 #include "window.h"
 #include "blockinput.h"
-#include "character.h"
 #include "buffer.h"
-#include "charset.h"
 #include "coding.h"
 #include "sysselect.h"
 
@@ -63,8 +61,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <sys/types.h>
 #endif
 
-#include "dispextern.h"
-
 #ifdef HAVE_X_WINDOWS
 /*  Defining HAVE_MULTILINGUAL_MENU would mean that the toolkit menu
     code accepts the Emacs internal encoding.  */
diff --git a/src/xml.c b/src/xml.c
index 9e68fff..fc77f22 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -25,7 +25,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <libxml/HTMLparser.h>
 
 #include "lisp.h"
-#include "character.h"
 #include "buffer.h"
 
 \f
diff --git a/src/xrdb.c b/src/xrdb.c
index 2235b45..ce6e7d2 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -43,11 +43,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <pwd.h>
 #endif
 
-#ifdef USE_MOTIF
-/* For Vdouble_click_time.  */
-#include "keyboard.h"
-#endif
-
 /* X file search path processing.  */
 
 
diff --git a/src/xselect.c b/src/xselect.c
index 9a7e697..9d178a5 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -31,12 +31,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "xterm.h"	/* for all of the X includes */
-#include "dispextern.h"	/* frame.h seems to want this */
 #include "frame.h"	/* Need this to get the X window of selected_frame */
 #include "blockinput.h"
-#include "character.h"
-#include "buffer.h"
-#include "process.h"
 #include "termhooks.h"
 #include "keyboard.h"
 
diff --git a/src/xsmfns.c b/src/xsmfns.c
index 3b06f71..b84f2ac 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -32,8 +32,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdio.h>
 
 #include "lisp.h"
-#include "systime.h"
-#include "sysselect.h"
 #include "frame.h"
 #include "termhooks.h"
 #include "xterm.h"
diff --git a/src/xterm.c b/src/xterm.c
index fcd81a1..691ad05 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -28,7 +28,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "blockinput.h"
-#include "syssignal.h"
 
 /* This may include sys/types.h, and that somehow loses
    if this is not done before the other system files.  */
@@ -58,12 +57,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <fcntl.h>
 #include <errno.h>
 #include <sys/stat.h>
-/* Caused redefinition of DBL_DIG on Netbsd; seems not to be needed.  */
-/* #include <sys/param.h>  */
-
-#include "charset.h"
 #include "character.h"
 #include "coding.h"
+#include "composite.h"
 #include "frame.h"
 #include "dispextern.h"
 #include "fontset.h"
@@ -71,17 +67,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "termopts.h"
 #include "termchar.h"
 #include "emacs-icon.h"
-#include "disptab.h"
 #include "buffer.h"
 #include "window.h"
 #include "keyboard.h"
-#include "intervals.h"
-#include "process.h"
 #include "atimer.h"
-#include "keymap.h"
 #include "font.h"
 #include "xsettings.h"
-#include "xgselect.h"
 #include "sysselect.h"
 #include "menu.h"
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-10-21  1:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-19  7:05 bug#21707: include-file cleanup for src directory Paul Eggert
2015-10-19  7:23 ` Eli Zaretskii
2015-10-19 12:54   ` Andy Moreton
2015-10-19 13:23     ` Eli Zaretskii
2015-10-20  5:54   ` Paul Eggert
2015-10-20  8:23     ` Andy Moreton
2015-10-20 15:06       ` Eli Zaretskii
2015-10-20 15:06     ` Eli Zaretskii
2015-10-20 18:50       ` Paul Eggert
2015-10-20 19:15         ` Eli Zaretskii
2015-10-20 20:52           ` Paul Eggert
2015-10-20 19:28         ` Andy Moreton
2015-10-21  1:38 ` Paul Eggert

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.