Function: antlr-option-location
antlr-option-location is a byte-compiled function defined in
antlr-mode.el.gz.
Signature
(antlr-option-location ORIG MIN-VIS MAX-VIS MIN-AREA MAX-AREA WITHP)
Documentation
Return location for the options area.
ORIG is the original position of point, MIN-VIS is point-min and
MAX-VIS is point-max. If WITHP is non-nil, there exists an option
specification and it starts after the brace at MIN-AREA and stops at
MAX-AREA. If WITHP is nil, there is no area and the region where it
could be inserted starts at MIN-AREA and stops at MAX-AREA.
The result has the form (AREA . PLACE). AREA is (MIN-AREA . MAX-AREA) if WITHP is non-nil, and nil otherwise. PLACE is nil if the area is invisible, (ORIG) if ORIG is inside the area, (MIN-AREA . beginning) for a visible start position and (MAX-AREA . end) for a visible end position where the beginning is preferred if WITHP is nil and the end if WITHP is non-nil.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/antlr-mode.el.gz
(defun antlr-option-location (orig min-vis max-vis min-area max-area withp)
;; checkdoc-order: nil
"Return location for the options area.
ORIG is the original position of `point', MIN-VIS is `point-min' and
MAX-VIS is `point-max'. If WITHP is non-nil, there exists an option
specification and it starts after the brace at MIN-AREA and stops at
MAX-AREA. If WITHP is nil, there is no area and the region where it
could be inserted starts at MIN-AREA and stops at MAX-AREA.
The result has the form (AREA . PLACE). AREA is (MIN-AREA . MAX-AREA)
if WITHP is non-nil, and nil otherwise. PLACE is nil if the area is
invisible, (ORIG) if ORIG is inside the area, (MIN-AREA . beginning) for
a visible start position and (MAX-AREA . end) for a visible end position
where the beginning is preferred if WITHP is nil and the end if WITHP is
non-nil."
(cons (and withp (cons min-area max-area))
(cond ((and (<= min-area orig) (<= orig max-area)
(save-excursion
(goto-char orig)
(not (memq (antlr-syntactic-context)
'(comment block-comment)))))
;; point in options area and not in comment
(list orig))
((and (null withp) (<= min-vis min-area) (<= min-area max-vis))
;; use start of options area (only if not `withp')
(cons min-area 'beginning))
((and (<= min-vis max-area) (<= max-area max-vis))
;; use end of options area
(cons max-area 'end))
((and withp (<= min-vis min-area) (<= min-area max-vis))
;; use start of options area (only if `withp')
(cons min-area 'beginning)))))