Mercurial > emacs
annotate lwlib/lwlib-utils.c @ 105813:df4934f25eef
* textmodes/two-column.el (2C-split):
* textmodes/texnfo-upd.el (texinfo-multi-file-included-list):
* textmodes/tex-mode.el (tex-set-buffer-directory):
* textmodes/spell.el (spell-region, spell-string):
* textmodes/reftex.el (reftex-erase-buffer):
(reftex-get-file-buffer-force, reftex-kill-temporary-buffers):
* textmodes/reftex-toc.el (reftex-toc-promote-action):
* textmodes/reftex-sel.el (reftex-get-offset, reftex-insert-docstruct)
(reftex-select-item):
* textmodes/reftex-ref.el (reftex-label-info-update)
(reftex-offer-label-menu):
* textmodes/reftex-index.el (reftex-index-change-entry)
(reftex-index-phrases-info):
* textmodes/reftex-global.el (reftex-create-tags-file)
(reftex-save-all-document-buffers, reftex-ensure-write-access):
* textmodes/reftex-dcr.el (reftex-echo-ref, reftex-echo-cite)
(reftex-view-crossref-from-bibtex):
* textmodes/reftex-cite.el (reftex-bibtex-selection-callback)
(reftex-extract-bib-entries-from-thebibliography)
(reftex-all-used-citation-keys, reftex-create-bibtex-file):
* textmodes/refbib.el (r2b-capitalize-title):
(r2b-convert-buffer, r2b-help):
* textmodes/page-ext.el (pages-directory)
(pages-directory-goto-with-mouse):
* textmodes/bibtex.el (bibtex-validate-globally):
* textmodes/bib-mode.el (bib-capitalize-title):
* textmodes/artist.el (artist-clear-buffer, artist-system):
* progmodes/xscheme.el (global-set-scheme-interaction-buffer):
(local-set-scheme-interaction-buffer, xscheme-process-filter)
(verify-xscheme-buffer, xscheme-enter-interaction-mode)
(xscheme-enter-debugger-mode, xscheme-debugger-mode-p)
(xscheme-send-control-g-interrupt, xscheme-start-process)
(xscheme-process-sentinel, xscheme-cd):
* progmodes/verilog-mode.el (verilog-read-always-signals)
(verilog-set-define, verilog-getopt-file)
(verilog-module-inside-filename-p):
* progmodes/sh-script.el:
* progmodes/python.el (python-pdbtrack-get-source-buffer)
(python-pdbtrack-grub-for-buffer, python-execute-file):
* progmodes/octave-inf.el (inferior-octave):
* progmodes/idlwave.el (idlwave-scan-user-lib-files)
(idlwave-shell-compile-helper-routines, idlwave-set-local)
(idlwave-display-completion-list-xemacs, idlwave-list-abbrevs)
(idlwave-display-completion-list-emacs, idlwave-list-load-path-shadows)
(idlwave-completion-fontify-classes, idlwave-display-calling-sequence):
* progmodes/idlw-shell.el (idlwave-shell-examine-display-clear)
(idlwave-shell-filter, idlwave-shell-examine-highlight)
(idlwave-shell-sentinel, idlwave-shell-filter-directory)
(idlwave-shell-display-line, idlwave-shell-set-bp-in-module)
(idlwave-shell-examine-display, idlwave-shell-run-region)
(idlwave-shell-filter-bp, idlwave-shell-save-and-action)
(idlwave-shell-sources-filter, idlwave-shell-goto-next-error):
* progmodes/idlw-help.el (idlwave-help-get-special-help)
(idlwave-help-get-help-buffer):
* progmodes/gud.el (gud-basic-call, gud-find-class)
(gud-tooltip-activate-mouse-motions-if-enabled):
* progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe):
* progmodes/ebrowse.el (ebrowse-member-table, ebrowse-save-tree-as)
(ebrowse-view-exit-fn, ebrowse-tags-list-members-in-file)
(ebrowse-tags-next-file):
* progmodes/ebnf2ps.el (ebnf-generate-eps, ebnf-generate-eps)
(ebnf-eps-production-list, ebnf-begin-file, ebnf-log)
(ebnf-eps-finish-and-write):
* progmodes/cpp.el (cpp-edit-save):
* progmodes/cperl-mode.el (cperl-pod-to-manpage):
* progmodes/cc-defs.el (c-emacs-features):
* progmodes/antlr-mode.el (antlr-invalidate-context-cache)
(antlr-directory-dependencies):
* progmodes/ada-xref.el (ada-gnat-parse-gpr, ada-get-ali-file-name)
(ada-run-application, ada-find-in-src-path, ada-goto-parent)
(ada-find-any-references, ada-make-filename-from-adaname)
(ada-make-body-gnatstub):
* obsolete/rnews.el (news-list-news-groups):
* obsolete/resume.el (resume-suspend-hook,resume-write-buffer-to-file):
* obsolete/iso-acc.el (iso-acc-minibuf-setup):
* net/rcirc.el (rcirc-debug):
* net/newst-treeview.el (newsticker--treeview-list-add-item)
(newsticker--treeview-list-clear, newsticker-treeview-browse-url)
(newsticker--treeview-list-update-faces, newsticker-treeview-save)
(newsticker--treeview-item-show-text, newsticker--treeview-item-show)
(newsticker--treeview-tree-update-tag,newsticker--treeview-buffer-init)
(newsticker-treeview-show-item, newsticker--treeview-unfold-node)
(newsticker--treeview-list-clear-highlight)
(newsticker--treeview-list-update-highlight)
(newsticker--treeview-list-highlight-start)
(newsticker--treeview-tree-update-highlight)
(newsticker--treeview-get-selected-item)
(newsticker-treeview-mark-list-items-old)
(newsticker--treeview-set-current-node):
* net/newst-plainview.el (newsticker--buffer-set-uptodate):
* net/newst-backend.el (newsticker--get-news-by-funcall)
(newsticker--get-news-by-wget, newsticker--image-get)
(newsticker--image-sentinel):
* net/mairix.el (mairix-rmail-fetch-field, mairix-gnus-fetch-field):
* net/eudcb-ph.el (eudc-ph-do-request, eudc-ph-open-session):
(eudc-ph-close-session):
* net/eudc.el (eudc-save-options):
* language/thai-word.el (thai-update-word-table):
* language/japan-util.el (japanese-string-conversion):
* international/titdic-cnv.el (tsang-quick-converter)
(ziranma-converter, ctlau-converter):
* international/mule-cmds.el (describe-language-environment):
* international/ja-dic-cnv.el (skkdic-convert-okuri-ari)
(skkdic-convert-postfix, skkdic-convert-prefix):
(skkdic-convert-okuri-nasi, skkdic-convert):
* emacs-lisp/re-builder.el (reb-update-overlays):
* emacs-lisp/pp.el (pp-to-string, pp-display-expression):
* emacs-lisp/gulp.el (gulp-send-requests):
* emacs-lisp/find-gc.el (trace-call-tree):
* emacs-lisp/eieio-opt.el (eieio-browse, eieio-describe-class)
(eieio-describe-generic):
* emacs-lisp/eieio-base.el (eieio-persistent-read):
* emacs-lisp/edebug.el (edebug-outside-excursion):
* emacs-lisp/debug.el (debugger-make-xrefs):
* emacs-lisp/cust-print.el (custom-prin1-to-string):
* emacs-lisp/chart.el (chart-new-buffer):
* emacs-lisp/authors.el (authors-scan-el, authors-scan-change-log):
Use with-current-buffer.
* textmodes/artist.el (artist-system): Don't call
copy-sequence on a fresh string.
* progmodes/idlw-shell.el (easymenu setup): Use dolist.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sat, 31 Oct 2009 02:38:34 +0000 |
parents | 68dd71358159 |
children | 1d1d5d9bd884 |
rev | line source |
---|---|
5626 | 1 /* Defines some widget utility functions. |
76177 | 2 Copyright (C) 1992 Lucid, Inc. |
3 Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, | |
100957 | 4 2007, 2008, 2009 Free Software Foundation, Inc. |
5626 | 5 |
6 This file is part of the Lucid Widget Library. | |
7 | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
41767
diff
changeset
|
8 The Lucid Widget Library is free software; you can redistribute it and/or |
5626 | 9 modify it under the terms of the GNU General Public License as published by |
10 the Free Software Foundation; either version 1, or (at your option) | |
11 any later version. | |
12 | |
13 The Lucid Widget Library is distributed in the hope that it will be useful, | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
41767
diff
changeset
|
14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
5626 | 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 GNU General Public License for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with GNU Emacs; see the file COPYING. If not, write to | |
64083 | 20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 Boston, MA 02110-1301, USA. */ | |
5626 | 22 |
11358
cba458f0dc21
If HAVE_CONFIG_H, include config.h.
Richard M. Stallman <rms@gnu.org>
parents:
7514
diff
changeset
|
23 #ifdef HAVE_CONFIG_H |
cba458f0dc21
If HAVE_CONFIG_H, include config.h.
Richard M. Stallman <rms@gnu.org>
parents:
7514
diff
changeset
|
24 #include <config.h> |
cba458f0dc21
If HAVE_CONFIG_H, include config.h.
Richard M. Stallman <rms@gnu.org>
parents:
7514
diff
changeset
|
25 #endif |
cba458f0dc21
If HAVE_CONFIG_H, include config.h.
Richard M. Stallman <rms@gnu.org>
parents:
7514
diff
changeset
|
26 |
13758
5a7e9e98add7
Add #undef for index and rindex.
Karl Heuer <kwzh@gnu.org>
parents:
11358
diff
changeset
|
27 /* Definitions of these in config.h can cause |
5a7e9e98add7
Add #undef for index and rindex.
Karl Heuer <kwzh@gnu.org>
parents:
11358
diff
changeset
|
28 declaration conflicts later on between declarations for index |
5a7e9e98add7
Add #undef for index and rindex.
Karl Heuer <kwzh@gnu.org>
parents:
11358
diff
changeset
|
29 and declarations for strchr. This file doesn't use |
5a7e9e98add7
Add #undef for index and rindex.
Karl Heuer <kwzh@gnu.org>
parents:
11358
diff
changeset
|
30 index and rindex, so cancel them. */ |
5a7e9e98add7
Add #undef for index and rindex.
Karl Heuer <kwzh@gnu.org>
parents:
11358
diff
changeset
|
31 #undef index |
5a7e9e98add7
Add #undef for index and rindex.
Karl Heuer <kwzh@gnu.org>
parents:
11358
diff
changeset
|
32 #undef rindex |
5a7e9e98add7
Add #undef for index and rindex.
Karl Heuer <kwzh@gnu.org>
parents:
11358
diff
changeset
|
33 |
105669
68dd71358159
* alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100957
diff
changeset
|
34 #include <setjmp.h> |
41767 | 35 #include "../src/lisp.h" |
36 | |
5626 | 37 #include <X11/Xatom.h> |
38 #include <X11/IntrinsicP.h> | |
39 #include <X11/ObjectP.h> | |
40 #include "lwlib-utils.h" | |
29891 | 41 #include "lwlib.h" |
5626 | 42 |
43 /* Redisplay the contents of the widget, without first clearing it. */ | |
44 void | |
5708
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
45 XtNoClearRefreshWidget (widget) |
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
46 Widget widget; |
5626 | 47 { |
48 XEvent event; | |
49 | |
50 event.type = Expose; | |
51 event.xexpose.serial = 0; | |
52 event.xexpose.send_event = 0; | |
53 event.xexpose.display = XtDisplay (widget); | |
54 event.xexpose.window = XtWindow (widget); | |
55 event.xexpose.x = 0; | |
56 event.xexpose.y = 0; | |
57 event.xexpose.width = widget->core.width; | |
58 event.xexpose.height = widget->core.height; | |
59 event.xexpose.count = 0; | |
60 | |
61 (*widget->core.widget_class->core_class.expose) | |
62 (widget, &event, (Region)NULL); | |
63 } | |
64 | |
65 | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
41767
diff
changeset
|
66 /* |
5626 | 67 * Apply a function to all the subwidgets of a given widget recursively. |
68 */ | |
69 void | |
5708
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
70 XtApplyToWidgets (w, proc, arg) |
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
71 Widget w; |
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
72 XtApplyToWidgetsProc proc; |
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
73 XtPointer arg; |
5626 | 74 { |
75 if (XtIsComposite (w)) | |
76 { | |
77 CompositeWidget cw = (CompositeWidget) w; | |
78 /* We have to copy the children list before mapping over it, because | |
79 the procedure might add/delete elements, which would lose badly. | |
80 */ | |
81 int nkids = cw->composite.num_children; | |
82 Widget *kids = (Widget *) malloc (sizeof (Widget) * nkids); | |
83 int i; | |
30279
3f00bdb24c1f
(XtApplyToWidgets): Cast args of lwlib_bcopy.
Dave Love <fx@gnu.org>
parents:
29891
diff
changeset
|
84 lwlib_bcopy ((char *) cw->composite.children, (char *) kids, |
3f00bdb24c1f
(XtApplyToWidgets): Cast args of lwlib_bcopy.
Dave Love <fx@gnu.org>
parents:
29891
diff
changeset
|
85 sizeof (Widget) * nkids); |
5626 | 86 for (i = 0; i < nkids; i++) |
87 /* This prevent us from using gadgets, why is it here? */ | |
88 /* if (XtIsWidget (kids [i])) */ | |
89 { | |
90 /* do the kiddies first in case we're destroying */ | |
91 XtApplyToWidgets (kids [i], proc, arg); | |
92 proc (kids [i], arg); | |
93 } | |
94 free (kids); | |
95 } | |
96 } | |
97 | |
98 | |
99 /* | |
100 * Apply a function to all the subwidgets of a given widget recursively. | |
101 * Stop as soon as the function returns non NULL and returns this as a value. | |
102 */ | |
103 void * | |
5708
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
104 XtApplyUntilToWidgets (w, proc, arg) |
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
105 Widget w; |
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
106 XtApplyUntilToWidgetsProc proc; |
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
107 XtPointer arg; |
5626 | 108 { |
109 void* result; | |
110 if (XtIsComposite (w)) | |
111 { | |
112 CompositeWidget cw = (CompositeWidget)w; | |
113 int i; | |
114 for (i = 0; i < cw->composite.num_children; i++) | |
115 if (XtIsWidget (cw->composite.children [i])){ | |
116 result = proc (cw->composite.children [i], arg); | |
117 if (result) | |
118 return result; | |
119 result = XtApplyUntilToWidgets (cw->composite.children [i], proc, | |
120 arg); | |
121 if (result) | |
122 return result; | |
123 } | |
124 } | |
125 return NULL; | |
126 } | |
127 | |
128 | |
129 /* | |
130 * Returns a copy of the list of all children of a composite widget | |
131 */ | |
132 Widget * | |
5708
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
133 XtCompositeChildren (widget, number) |
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
134 Widget widget; |
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
135 unsigned int* number; |
5626 | 136 { |
137 CompositeWidget cw = (CompositeWidget)widget; | |
138 Widget* result; | |
139 int n; | |
140 int i; | |
141 | |
142 if (!XtIsComposite (widget)) | |
143 { | |
144 *number = 0; | |
145 return NULL; | |
146 } | |
147 n = cw->composite.num_children; | |
148 result = (Widget*)XtMalloc (n * sizeof (Widget)); | |
149 *number = n; | |
150 for (i = 0; i < n; i++) | |
151 result [i] = cw->composite.children [i]; | |
152 return result; | |
153 } | |
154 | |
155 Boolean | |
5708
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
156 XtWidgetBeingDestroyedP (widget) |
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
157 Widget widget; |
5626 | 158 { |
159 return widget->core.being_destroyed; | |
160 } | |
161 | |
162 void | |
5708
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
163 XtSafelyDestroyWidget (widget) |
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
164 Widget widget; |
5626 | 165 { |
166 #if 0 | |
167 | |
168 /* this requires IntrinsicI.h (actually, InitialI.h) */ | |
169 | |
170 XtAppContext app = XtWidgetToApplicationContext(widget); | |
171 | |
172 if (app->dispatch_level == 0) | |
173 { | |
174 app->dispatch_level = 1; | |
175 XtDestroyWidget (widget); | |
176 /* generates an event so that the event loop will be called */ | |
177 XChangeProperty (XtDisplay (widget), XtWindow (widget), | |
178 XA_STRING, XA_STRING, 32, PropModeAppend, NULL, 0); | |
179 app->dispatch_level = 0; | |
180 } | |
181 else | |
182 XtDestroyWidget (widget); | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
41767
diff
changeset
|
183 |
5626 | 184 #else |
185 abort (); | |
186 #endif | |
187 } | |
52401 | 188 |
189 /* arch-tag: f21f0a1f-2a4e-44e1-8715-7f234fe2d159 | |
190 (do not change this comment) */ |