Mercurial > emacs
annotate admin/alloc-colors.c @ 85769:de8ef384c3ef
* allout.el (allout-command-prefix, allout-inhibit-auto-fill):
Relocate in file.
(allout-doublecheck-at-and-shallower): Increase to include
slightly greater depths, since yank interaction is now ok. Also,
elaborate the docstring to explain the situation.
(produce-allout-mode-map, allout-hotspot-key-handler): Use vconcat
instead of concat, so we accommodate key sequences expressed as
vectors as well as strings and lists.
(allout-flag-region, allout-hide-by-annotation): Make the
hidden-text overlays 'front-advance.
(allout-overlay-insert-in-front-handler): Correct docstring's
grammar.
(allout-aberrant-container-p, allout-on-current-heading-p)
(allout-e-o-prefix-p, allout-next-heading)
(allout-previous-heading, allout-goto-prefix)
(allout-end-of-prefix, allout-next-sibling-leap)
(allout-next-visible-heading, allout-auto-fill)
(allout-rebullet-heading, allout-kill-line, allout-kill-topic)
(allout-yank-processing, allout-resolve-xref)
(allout-current-topic-collapsed-p, allout-hide-region-body)
(allout-latex-verbatim-quote-curr-line, allout-encrypt-string)
(allout-encrypted-topic-p, allout-next-topic-pending-encryption)
(count-trailing-whitespace-region): Preserve match data, so allout
outline navigation doesn't disrupt other emacs operations.
(allout-beginning-of-line): Retreat to the beginning of the hidden
text, so fields are respected (for submodes that care).
(allout-end-of-line): Preserve mark activation status when
jumping.
(allout-open-topic): Account for opening after a child that
contains a hidden trailing newline. Preserve match data. Run
allout-structure-added-hook
(allout-encrypt-decrypted): Preserve match data.
(allout-toggle-current-subtree-exposure): Add new interactive
function for toggle subtree exposure - suggested by tassilo.
(move-beginning-of-line, move-end-of-line): Don't use
line-move-invisible-p, it's obsolete - substitute the code,
instead.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Mon, 29 Oct 2007 23:10:09 +0000 |
parents | 450fa81c5930 |
children | cde444d03b82 f55f9811f5d7 |
rev | line source |
---|---|
39991 | 1 /* Allocate X colors. Used for testing with dense colormaps. |
75348 | 2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 |
3 Free Software Foundation, Inc. | |
39991 | 4 |
5 This file is part of GNU Emacs. | |
6 | |
7 GNU Emacs is free software; you can redistribute it and/or modify | |
8 it under the terms of the GNU General Public License as published by | |
78240
450fa81c5930
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75348
diff
changeset
|
9 the Free Software Foundation; either version 3, or (at your option) |
39991 | 10 any later version. |
11 | |
12 GNU Emacs is distributed in the hope that it will be useful, | |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 GNU General Public License for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
18 along with GNU Emacs; see the file COPYING. If not, write to | |
64079 | 19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 Boston, MA 02110-1301, USA. */ | |
39991 | 21 |
22 #include <X11/Xlib.h> | |
23 #include <stdio.h> | |
24 #include <stdlib.h> | |
25 #include <stdarg.h> | |
26 #include <unistd.h> | |
27 | |
28 void | |
29 fatal (const char *fmt, ...) | |
30 { | |
31 va_list ap; | |
32 | |
33 va_start (ap, fmt); | |
34 vfprintf (stderr, fmt, ap); | |
35 fputc ('\n', stderr); | |
36 va_end (ap); | |
37 exit (1); | |
38 } | |
39 | |
40 void | |
41 usage (const char *progname) | |
42 { | |
43 fprintf (stderr, "Usage %s options\n", progname); | |
44 fprintf (stderr, "-n NCOLORS allcoate NCOLORS colors\n"); | |
45 exit (1); | |
46 } | |
47 | |
48 int | |
49 main (int argc, char **argv) | |
50 { | |
51 Display *dpy; | |
52 int opt, ncolors = 0, i; | |
53 XColor *allocated; | |
54 int nallocated; | |
55 XColor color; | |
56 Colormap cmap; | |
57 | |
58 while ((opt = getopt (argc, argv, "n:")) != EOF) | |
59 switch (opt) | |
60 { | |
61 case 'n': | |
62 ncolors = atoi (optarg); | |
63 break; | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39991
diff
changeset
|
64 |
39991 | 65 case '?': |
66 usage (argv[0]); | |
67 } | |
68 | |
69 if (ncolors == 0) | |
70 usage (argv[0]); | |
71 | |
72 dpy = XOpenDisplay (""); | |
73 if (dpy == NULL) | |
74 fatal ("Cannot open display"); | |
75 cmap = DefaultColormap (dpy, 0); | |
76 | |
77 allocated = malloc (ncolors * sizeof *allocated); | |
78 nallocated = 0; | |
79 memset (&color, 0, sizeof color); | |
80 | |
81 while (nallocated < ncolors | |
82 && color.red < 65536) | |
83 { | |
84 allocated[nallocated] = color; | |
85 if (XAllocColor (dpy, cmap, &allocated[nallocated])) | |
86 { | |
87 for (i = 0; i < nallocated; ++i) | |
88 if (allocated[i].red == allocated[nallocated].red | |
89 && allocated[i].green == allocated[nallocated].green | |
90 && allocated[i].blue == allocated[nallocated].blue) | |
91 break; | |
92 | |
93 if (i == nallocated) | |
94 { | |
95 printf ("allocated %d/%d/%d\n", | |
96 allocated[nallocated].red, | |
97 allocated[nallocated].green, | |
98 allocated[nallocated].blue); | |
99 ++nallocated; | |
100 } | |
101 } | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39991
diff
changeset
|
102 |
39991 | 103 ++color.red; |
104 ++color.green; | |
105 ++color.blue; | |
106 } | |
107 | |
108 fprintf (stderr, "Waiting. Press ^C to stop.\n"); | |
109 while (1) | |
110 sleep (10); | |
111 | |
112 XCloseDisplay (dpy); | |
113 return 0; | |
114 } | |
52401 | 115 |
116 /* arch-tag: f1be90ac-5b70-43c2-835e-5a6432a25145 | |
117 (do not change this comment) */ |