Mercurial > emacs
annotate oldXMenu/FindSel.c @ 26058:c11f0832a7c5
(Fconstrain_to_field): Make sure we don't violate the
argument preconditions of find_before_next_newline in the case
where both ONLY_IN_LINE and ESCAPE_FROM_EDGE are set and OLD_POS
was indeed at the edge.
(text_property_eq, text_property_stickiness): Don't
use initializers for auto variables of type Lisp_Object.
(find_field): Likewise. Use braces around nested ifs.
(Fline_end_position): Store the raw eol in a variable, so that the
final expression doesn't look so ugly.
(Fconstrain_to_field): Doc fix.
(preceding_pos): Renamed from `preceeding_pos'.
(text_property_stickiness, find_field): Call preceding_pos,
not preceeding_pos.
(Ffield_string_no_properties): New function.
(text_property_stickiness, preceeding_pos): New functions.
(Ffield_string): Remove PROPS parameter.
(find_field): Add MERGE_AT_BOUNDARY parameter.
Rewrite to use stickiness of `field' property to resolve
ambiguous cases.
(Ffield_beginning, Ffield_end): Add ESCAPE_FROM_EDGE parameter.
(Fconstrain_to_field): Likewise.
(syms_of_editfns): Init Sfield_string_no_properties.
(Ffield_string, Ferase_field, Ffield_end):
Supply new MERGE_AT_BOUNDARY argument to find_field.
(Fline_beginning_position, Fline_end_position): Supply new
ESCAPE_FROM_EDGE parameter to Fconstrain_to_field.
Pass a value of Qt for the ONLY_IN_LINE argument to
Fconstrain_to_field (only matters if N != 1).
(Fconstrain_to_field): Add get/set-current-point
behavior when NEW_POS is nil.
(find_field): Use XSETFASTINT instead of make_number.
(Qfield): New variable.
(find_field, Ferase_field, Ffield_string,
Ffield_beginning, Ffield_end, Fconstrain_to_field): New functions.
(Fline_beginning_position, Fline_end_position): Constrain to any field.
(make_buffer_string_both): Remove minibuffer-prompt hack.
(syms_of_editfns): Initialize Qfield, and subr entries for
field functions above.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Sun, 17 Oct 1999 12:55:00 +0000 |
parents | bbce331da1be |
children | 695cf19ef79e d7ddb3e565de |
rev | line source |
---|---|
25858 | 1 #include "copyright.h" |
2 | |
3 /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/FindSel.c,v 1.1 1992/04/11 22:10:19 jimb Exp $ */ | |
4 /* Copyright Massachusetts Institute of Technology 1985 */ | |
5 | |
6 /* | |
7 * XMenu: MIT Project Athena, X Window system menu package | |
8 * | |
9 * XMenuFindSelection - Find the first selection in a pane who's | |
10 * label matches a particular string. | |
11 * | |
12 * Author: Tony Della Fera, DEC | |
13 * January 22, 1986 | |
14 * | |
15 */ | |
16 | |
17 #include "XMenuInt.h" | |
18 | |
19 int | |
20 XMenuFindSelection(menu, p_num, label) | |
21 register XMenu *menu; | |
22 int p_num; | |
23 register char *label; | |
24 { | |
25 register XMPane *p_ptr; | |
26 register XMSelect *s_ptr; | |
27 register int i = 0; | |
28 | |
29 /* | |
30 * Check for NULL pointers! | |
31 */ | |
32 if (label == NULL) { | |
33 _XMErrorCode = XME_ARG_BOUNDS; | |
34 return(XM_FAILURE); | |
35 } | |
36 | |
37 /* | |
38 * Find the right pane. | |
39 */ | |
40 p_ptr = _XMGetPanePtr(menu, p_num); | |
41 if (p_ptr == NULL) return(XM_FAILURE); | |
42 | |
43 /* | |
44 * Find the right selection. | |
45 */ | |
46 for ( | |
47 s_ptr = p_ptr->s_list->next; | |
48 s_ptr != p_ptr->s_list; | |
49 s_ptr = s_ptr->next | |
50 ){ | |
51 if (s_ptr->label_length == 0) { | |
52 if (*label == '\0') { | |
53 _XMErrorCode = XME_NO_ERROR; | |
54 return (i); | |
55 } | |
56 } | |
57 else { | |
58 if (strncmp (label, s_ptr->label, s_ptr->label_length) == 0) { | |
59 _XMErrorCode = XME_NO_ERROR; | |
60 return (i); | |
61 } | |
62 } | |
63 i++; | |
64 } | |
65 | |
66 /* | |
67 * If we get here then we have not found | |
68 * a match. | |
69 */ | |
70 _XMErrorCode = XME_S_NOT_FOUND; | |
71 return (XM_FAILURE); | |
72 } |