annotate oldXMenu/FindSel.c @ 110017:10e66ac64b61

Merge Finder and package-menu functionality. * lisp/finder.el: Require `package'. (finder-known-keywords): Tweak descriptions. Retire `oop' keyword. (finder-package-info): Var deleted. (finder-keywords-hash, finder--builtins-alist): New vars. (finder-compile-keywords): Compute package--builtins and finder-keywords-hash instead of finder-keywords-hash, respecting the "Package" header. (finder-unknown-keywords, finder-list-matches): Use finder-keywords-hash and package--list-packages. (finder-mode): Don't set font-lock-defaults. (finder-exit): We don't use "*Finder-package*" and "*Finder Category*" buffers anymore. * lisp/info.el (Info-finder-find-node): Search package-alist instead of finder-package-info. * lisp/emacs-lisp/package.el (package--builtins-base): Var deleted. (package--builtins): Set default value to nil. (package-initialize): Load precomputed value of package--builtins from finder-inf.el. (package-alist, package-compute-transaction) (package-download-transaction): Improve docstring. (package-read-all-archive-contents): Do not change package--builtins here. (list-packages): Make package-list-packages an alias for this. Sort by status by default. (package--list-packages): Add optional PACKAGES arg. (describe-package-1): Use font-lock-face property. For built-in packages, insert file commentary. (package--generate-package-list): Rename from package-list-packages-internal; all callers changed. Add optional PACKAGES arg. Add alphabetical sort fallbacks. (package-menu--version-predicate, package-menu--status-predicate) (package-menu--description-predicate) (package-menu--name-predicate): New functions.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 29 Aug 2010 18:15:09 -0400
parents 5cc91198ffb2
children 417b1e4d63cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
100952
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
1 /* Copyright Massachusetts Institute of Technology 1985 */
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
2
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
3 #include "copyright.h"
Dave Love <fx@gnu.org>
parents:
diff changeset
4
100952
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
5 /*
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
6 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 100952
diff changeset
7 2009, 2010 Free Software Foundation, Inc.
100952
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
8
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
9 This program is free software: you can redistribute it and/or modify
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
10 it under the terms of the GNU General Public License as published by
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
11 the Free Software Foundation, either version 3 of the License, or
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
12 (at your option) any later version.
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
13
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
14 This program is distributed in the hope that it will be useful,
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
17 GNU General Public License for more details.
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
18
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
19 You should have received a copy of the GNU General Public License
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
54f43e0fcdc6 Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79743
diff changeset
21 */
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
22
Dave Love <fx@gnu.org>
parents:
diff changeset
23 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
24 * XMenu: MIT Project Athena, X Window system menu package
Dave Love <fx@gnu.org>
parents:
diff changeset
25 *
Dave Love <fx@gnu.org>
parents:
diff changeset
26 * XMenuFindSelection - Find the first selection in a pane who's
Dave Love <fx@gnu.org>
parents:
diff changeset
27 * label matches a particular string.
Dave Love <fx@gnu.org>
parents:
diff changeset
28 *
Dave Love <fx@gnu.org>
parents:
diff changeset
29 * Author: Tony Della Fera, DEC
Dave Love <fx@gnu.org>
parents:
diff changeset
30 * January 22, 1986
Dave Love <fx@gnu.org>
parents:
diff changeset
31 *
Dave Love <fx@gnu.org>
parents:
diff changeset
32 */
Dave Love <fx@gnu.org>
parents:
diff changeset
33
Dave Love <fx@gnu.org>
parents:
diff changeset
34 #include "XMenuInt.h"
Dave Love <fx@gnu.org>
parents:
diff changeset
35
Dave Love <fx@gnu.org>
parents:
diff changeset
36 int
109124
5cc91198ffb2 Convert function definitions in oldXMenu to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106815
diff changeset
37 XMenuFindSelection(register XMenu *menu, int p_num, register char *label)
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
38 {
Dave Love <fx@gnu.org>
parents:
diff changeset
39 register XMPane *p_ptr;
Dave Love <fx@gnu.org>
parents:
diff changeset
40 register XMSelect *s_ptr;
Dave Love <fx@gnu.org>
parents:
diff changeset
41 register int i = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
42
Dave Love <fx@gnu.org>
parents:
diff changeset
43 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
44 * Check for NULL pointers!
Dave Love <fx@gnu.org>
parents:
diff changeset
45 */
Dave Love <fx@gnu.org>
parents:
diff changeset
46 if (label == NULL) {
Dave Love <fx@gnu.org>
parents:
diff changeset
47 _XMErrorCode = XME_ARG_BOUNDS;
Dave Love <fx@gnu.org>
parents:
diff changeset
48 return(XM_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
49 }
Dave Love <fx@gnu.org>
parents:
diff changeset
50
Dave Love <fx@gnu.org>
parents:
diff changeset
51 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
52 * Find the right pane.
Dave Love <fx@gnu.org>
parents:
diff changeset
53 */
Dave Love <fx@gnu.org>
parents:
diff changeset
54 p_ptr = _XMGetPanePtr(menu, p_num);
Dave Love <fx@gnu.org>
parents:
diff changeset
55 if (p_ptr == NULL) return(XM_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
56
Dave Love <fx@gnu.org>
parents:
diff changeset
57 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
58 * Find the right selection.
Dave Love <fx@gnu.org>
parents:
diff changeset
59 */
Dave Love <fx@gnu.org>
parents:
diff changeset
60 for (
Dave Love <fx@gnu.org>
parents:
diff changeset
61 s_ptr = p_ptr->s_list->next;
Dave Love <fx@gnu.org>
parents:
diff changeset
62 s_ptr != p_ptr->s_list;
Dave Love <fx@gnu.org>
parents:
diff changeset
63 s_ptr = s_ptr->next
Dave Love <fx@gnu.org>
parents:
diff changeset
64 ){
Dave Love <fx@gnu.org>
parents:
diff changeset
65 if (s_ptr->label_length == 0) {
Dave Love <fx@gnu.org>
parents:
diff changeset
66 if (*label == '\0') {
Dave Love <fx@gnu.org>
parents:
diff changeset
67 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
68 return (i);
Dave Love <fx@gnu.org>
parents:
diff changeset
69 }
Dave Love <fx@gnu.org>
parents:
diff changeset
70 }
Dave Love <fx@gnu.org>
parents:
diff changeset
71 else {
Dave Love <fx@gnu.org>
parents:
diff changeset
72 if (strncmp (label, s_ptr->label, s_ptr->label_length) == 0) {
Dave Love <fx@gnu.org>
parents:
diff changeset
73 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
74 return (i);
Dave Love <fx@gnu.org>
parents:
diff changeset
75 }
Dave Love <fx@gnu.org>
parents:
diff changeset
76 }
Dave Love <fx@gnu.org>
parents:
diff changeset
77 i++;
Dave Love <fx@gnu.org>
parents:
diff changeset
78 }
Dave Love <fx@gnu.org>
parents:
diff changeset
79
Dave Love <fx@gnu.org>
parents:
diff changeset
80 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
81 * If we get here then we have not found
Dave Love <fx@gnu.org>
parents:
diff changeset
82 * a match.
Dave Love <fx@gnu.org>
parents:
diff changeset
83 */
Dave Love <fx@gnu.org>
parents:
diff changeset
84 _XMErrorCode = XME_S_NOT_FOUND;
Dave Love <fx@gnu.org>
parents:
diff changeset
85 return (XM_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
86 }
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 25858
diff changeset
87
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 25858
diff changeset
88 /* arch-tag: 564a4a95-9ab0-4580-b05f-6970c4b25dd4
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 25858
diff changeset
89 (do not change this comment) */