annotate src/EmacsShell.c @ 4539:061e030e3270

Fix some bugs in load-history construction, built-in symbol file names. lib-src/ChangeLog addition: 2008-12-27 Aidan Kehoe <kehoea@parhasard.net> * make-docfile.c (main): Allow more than one -d argument, followed by a directory to change to. (put_filename): Don't strip directory information; with previous change, allows retrieval of Lisp function and variable origin files from #'built-in-symbol-file relative to lisp-directory. (scan_lisp_file): Don't add an extraneous newline after the file name, put_filename has added the newline already. lisp/ChangeLog addition: 2008-12-27 Aidan Kehoe <kehoea@parhasard.net> * loadup.el (load-history): Add the contents of current-load-list to load-history before clearing it. Move the variable declarations earlier in the file to a format understood by make-docfile.c. * custom.el (custom-declare-variable): Add the variable's symbol to the current file's load history entry correctly, don't use a cons. Eliminate a comment that we don't need to worry about, we don't need to check the `initialized' C variable in Lisp. * bytecomp.el (byte-compile-output-file-form): Merge Andreas Schwab's pre-GPLv3 GNU change of 19970831 here; treat #'custom-declare-variable correctly, generating the docstrings in a format understood by make-docfile.c. * loadhist.el (symbol-file): Correct behaviour for checking autoloaded macros and functions when supplied with a TYPE argument. Accept fully-qualified paths from #'built-in-symbol-file; if a path is not fully-qualified, return it relative to lisp-directory if the filename corresponds to a Lisp file, and relative to (concat source-directory "/src/") otherwise. * make-docfile.el (preloaded-file-list): Rationalise some let bindings a little. Use the "-d" argument to make-docfile.c to supply Lisp paths relative to lisp-directory, not absolutely. Add in loadup.el explicitly to the list of files to be processed by make-docfile.c--it doesn't make sense to add it to preloaded-file-list, since that is used for purposes of byte-compilation too. src/ChangeLog addition: 2008-12-27 Aidan Kehoe <kehoea@parhasard.net> * doc.c (Fbuilt_in_symbol_file): Return a subr's filename immediately if we've found it. Check for compiled function and compiled macro docstrings in DOC too, and return them if they exist. The branch of the if statement focused on functions may have executed, but we may still want to check variable bindings; an else clause isn't appropriate.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 27 Dec 2008 14:05:50 +0000
parents 3d8143fc88e1
children 308d34e9f07d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Emacs shell widget -- glue.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Sun Microsystems, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 /* Written by Ben Wing, May, 1994. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 #include <stdio.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 #include <assert.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 #include <stdlib.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #include <X11/StringDefs.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 #include "xintrinsicp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #include <X11/Shell.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include <X11/ShellP.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #include "EmacsShell.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include "ExternalShell.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 428
diff changeset
37 #define ABORT abort
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 428
diff changeset
38
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #if 0 /* Not currently used */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 /* The root_geometry_manager() method in Shell.c is fucked up with regard
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 to the user-specified-position vs. program-specified-position and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 user-specified-size vs. program-specified-size flag. (It always
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 sets program-specified whenever the program requests a change
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 in its size or position, even when this came from direct user
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 request.) So we provide external entry points to fix this after
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 the program requested a size or position change. If it turns
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 out that the user-specified-position flag needs to be set at the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 *same* time that the geometry change request is made, then we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 will have to duplicate the entire root_geometry_manager() method;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 but I don't think there are any WM's that require this. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 /* junk stolen from IntrinsicI.h */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 extern void _XtAllocError( String /* alloc_type */);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 /* junk ungraciously copied from Shell.c */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 static void ComputeWMSizeHints(w, hints)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 WMShellWidget w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 XSizeHints *hints;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 long flags;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 hints->flags = flags = w->wm.size_hints.flags;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 #define copy(field) hints->field = w->wm.size_hints.field
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 if (flags & (USPosition | PPosition)) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 copy(x);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 copy(y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 if (flags & (USSize | PSize)) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 copy(width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 copy(height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 if (flags & PMinSize) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 copy(min_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 copy(min_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 if (flags & PMaxSize) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 copy(max_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 copy(max_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 if (flags & PResizeInc) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 copy(width_inc);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 copy(height_inc);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 if (flags & PAspect) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 copy(min_aspect.x);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 copy(min_aspect.y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 copy(max_aspect.x);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 copy(max_aspect.y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 #undef copy
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 #define copy(field) hints->field = w->wm.field
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 if (flags & PBaseSize) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 copy(base_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 copy(base_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 if (flags & PWinGravity)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 copy(win_gravity);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 #undef copy
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 static void _SetWMSizeHints(w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 WMShellWidget w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 XSizeHints *size_hints = XAllocSizeHints();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 if (size_hints == NULL) _XtAllocError("XAllocSizeHints");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 ComputeWMSizeHints(w, size_hints);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 XSetWMNormalHints(XtDisplay((Widget)w), XtWindow((Widget)w), size_hints);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 XFree((char*)size_hints);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 /* end of junk ungraciously copied from Shell.c */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 #endif /* 0 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 #if 0 /* Not currently used */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 EmacsShellSetSizeUserSpecified (Widget gw)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 WMShellWidget w = (WMShellWidget) gw;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 w->wm.size_hints.flags |= USSize;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 w->wm.size_hints.flags &= ~PSize;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 if (!w->shell.override_redirect && XtIsRealized (gw))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 _SetWMSizeHints (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 EmacsShellSetPositionUserSpecified (Widget gw)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 WMShellWidget w = (WMShellWidget) gw;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 w->wm.size_hints.flags |= USPosition;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 w->wm.size_hints.flags &= ~PPosition;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 if (!w->shell.override_redirect && XtIsRealized (gw))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 _SetWMSizeHints (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 #endif /* 0 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 EmacsShellSmashIconicHint (Widget shell, int iconic_p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 /* See comment in frame-x.c about this */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 WMShellWidget wmshell = (WMShellWidget) shell;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 assert (XtIsSubclass (shell, wmShellWidgetClass));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 /* old_state = (wmshell->wm.wm_hints.flags & StateHint
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 ? wmshell->wm.wm_hints.initial_state
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 : NormalState); */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 wmshell->wm.wm_hints.flags |= StateHint;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 wmshell->wm.wm_hints.initial_state = iconic_p ? IconicState : NormalState;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 EmacsShellUpdateSizeHints (Widget gw)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 if (XtIsSubclass (gw, topLevelEmacsShellWidgetClass))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 TopLevelEmacsShellUpdateSizeHints (gw);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 #ifdef EXTERNAL_WIDGET
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 else if (XtIsSubclass (gw, externalShellWidgetClass))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 /* do what ??? Don't abort! */;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 else if (XtIsSubclass (gw, transientEmacsShellWidgetClass))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 TransientEmacsShellUpdateSizeHints (gw);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 else
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 428
diff changeset
166 ABORT ();
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 }