Mercurial > hg > xemacs-beta
view lisp/mode-motion.el @ 5607:1a507c4c6c42
Refactor out sequence-oriented builtins from fns.c to the new sequence.c.
src/ChangeLog addition:
2011-12-04 Aidan Kehoe <kehoea@parhasard.net>
* Makefile.in.in (objs):
* depend:
Add sequence.o to the list of objects and dependencies.
* alloc.c:
* alloc.c (mark_bit_vector):
* alloc.c (print_bit_vector):
* alloc.c (bit_vector_equal):
* alloc.c (internal_bit_vector_equalp_hash):
* alloc.c (bit_vector_hash):
* alloc.c (init_alloc_once_early):
Move the implementation of the bit vector type here from fns.c.
* emacs.c (main_1):
Call syms_of_sequence() here, now sequence.c is included.
* fns.c (Fold_rassq):
Move this together with the rest of the Fold_* functions.
* fns.c:
* fns.c (syms_of_fns):
Move most functions dealing with sequences generally, and
especially those taking key arguments, to a separate file,
sequence.c.
* general-slots.h:
Qyes_or_no_p belong here, not fns.c.
* lisp.h:
Make Flist_length available here, it's used by sequence.c
* sequence.c:
* sequence.c (check_sequence_range):
* sequence.c (Flength):
* sequence.c (check_other_nokey):
* sequence.c (check_other_key):
* sequence.c (check_if_key):
* sequence.c (check_match_eq_key):
* sequence.c (check_match_eql_key):
* sequence.c (check_match_equal_key):
* sequence.c (check_match_equalp_key):
* sequence.c (check_match_other_key):
* sequence.c (check_lss_key):
* sequence.c (check_lss_key_car):
* sequence.c (check_string_lessp_key):
* sequence.c (check_string_lessp_key_car):
* sequence.c (get_check_match_function_1):
* sequence.c (get_merge_predicate):
* sequence.c (count_with_tail):
* sequence.c (list_count_from_end):
* sequence.c (string_count_from_end):
* sequence.c (Fcount):
* sequence.c (Fsubseq):
* sequence.c (list_position_cons_before):
* sequence.c (FmemberX):
* sequence.c (Fadjoin):
* sequence.c (FassocX):
* sequence.c (FrassocX):
* sequence.c (position):
* sequence.c (Fposition):
* sequence.c (Ffind):
* sequence.c (delq_no_quit_and_free_cons):
* sequence.c (FdeleteX):
* sequence.c (FremoveX):
* sequence.c (list_delete_duplicates_from_end):
* sequence.c (Fdelete_duplicates):
* sequence.c (Fremove_duplicates):
* sequence.c (Fnreverse):
* sequence.c (Freverse):
* sequence.c (list_merge):
* sequence.c (array_merge):
* sequence.c (list_array_merge_into_list):
* sequence.c (list_list_merge_into_array):
* sequence.c (list_array_merge_into_array):
* sequence.c (Fmerge):
* sequence.c (list_sort):
* sequence.c (array_sort):
* sequence.c (FsortX):
* sequence.c (Ffill):
* sequence.c (mapcarX):
* sequence.c (shortest_length_among_sequences):
* sequence.c (Fmapconcat):
* sequence.c (FmapcarX):
* sequence.c (Fmapvector):
* sequence.c (Fmapcan):
* sequence.c (Fmap):
* sequence.c (Fmap_into):
* sequence.c (Fsome):
* sequence.c (Fevery):
* sequence.c (Freduce):
* sequence.c (replace_string_range_1):
* sequence.c (Freplace):
* sequence.c (Fnsubstitute):
* sequence.c (Fsubstitute):
* sequence.c (subst):
* sequence.c (sublis):
* sequence.c (Fsublis):
* sequence.c (nsublis):
* sequence.c (Fnsublis):
* sequence.c (Fsubst):
* sequence.c (Fnsubst):
* sequence.c (tree_equal):
* sequence.c (Ftree_equal):
* sequence.c (mismatch_from_end):
* sequence.c (mismatch_list_list):
* sequence.c (mismatch_list_string):
* sequence.c (mismatch_list_array):
* sequence.c (mismatch_string_array):
* sequence.c (mismatch_string_string):
* sequence.c (mismatch_array_array):
* sequence.c (get_mismatch_func):
* sequence.c (Fmismatch):
* sequence.c (Fsearch):
* sequence.c (venn):
* sequence.c (nvenn):
* sequence.c (Funion):
* sequence.c (Fset_exclusive_or):
* sequence.c (Fnset_exclusive_or):
* sequence.c (syms_of_sequence):
Add this file, containing those general functions that dealt with
sequences that were in fns.c.
* symsinit.h:
Make syms_of_sequence() available here.
man/ChangeLog addition:
2011-12-04 Aidan Kehoe <kehoea@parhasard.net>
* internals/internals.texi (Basic Lisp Modules):
Document sequence.c here too.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 04 Dec 2011 18:42:50 +0000 |
parents | 308d34e9f07d |
children |
line wrap: on
line source
;;; mode-motion.el --- Mode-specific mouse-highlighting of text. ;; Copyright (C) 1992, 1993, 1997 Free Software Foundation, Inc. ;; Maintainer: XEmacs Development Team ;; Keywords: internal, mouse, dumped ;; This file is part of XEmacs. ;; XEmacs is free software: you can redistribute it and/or modify it ;; under the terms of the GNU General Public License as published by the ;; Free Software Foundation, either version 3 of the License, or (at your ;; option) any later version. ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ;; for more details. ;; You should have received a copy of the GNU General Public License ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>. ;;; Synched up with: Not in FSF. ;;; Commentary: ;; This file is dumped with XEmacs (when window system support is compiled in). ;;; Code: (defvar mode-motion-hook nil "Function or functions which are called whenever the mouse moves. Each function must take a single argument of the motion event. You should normally use this rather than `mouse-motion-handler', which does some additional window-system-dependent things. This hook is local to every buffer, and should normally be set up by major-modes which want to use special highlighting. Every time the mouse moves over a window, the mode-motion-hook of the buffer of that window is run.") (make-variable-buffer-local 'mode-motion-hook) (defvar mode-motion-extent nil) (make-variable-buffer-local 'mode-motion-extent) (defvar mode-motion-help-echo-string nil "String to be added as the 'help-echo property of the mode-motion extent. In order for this to work, you need to add the hook function `mode-motion-add-help-echo' to the mode-motion hook. If this is a function, it will be called with one argument (the event) and should return a string to be added. This variable is local to every buffer.") (make-variable-buffer-local 'mode-motion-help-echo-string) (defun mode-motion-ensure-extent-ok (event) (let ((buffer (event-buffer event))) (if (and (extent-live-p mode-motion-extent) (eq buffer (extent-object mode-motion-extent))) nil (setq mode-motion-extent (make-extent nil nil buffer)) (set-extent-property mode-motion-extent 'mouse-face 'highlight)))) (defun mode-motion-highlight-internal (event backward forward) (let* ((buffer (event-buffer event)) (point (and buffer (event-point event)))) (if (and buffer (not (eq buffer mouse-grabbed-buffer))) ;; #### ack!! Too many calls to save-window-excursion / ;; save-excursion (x-track-pointer calls, so does ;; minibuf-mouse-tracker ...) This needs to be looked ;; into. It's complicated by the fact that sometimes ;; a mode-motion-hook might really want to change ;; the point. ;; ;; #### The save-excursion must come before the ;; save-window-excursion in order to function properly. I ;; haven't given this much thought. Is it a bug that this ;; ordering is necessary or is it correct behavior? (save-excursion (save-window-excursion (set-buffer buffer) (mode-motion-ensure-extent-ok event) (if point ;; Use save-excursion here to avoid ;; save-window-excursion seeing a change in ;; window point's value which would make the ;; display code do a whole lot of useless work ;; and making the display flicker horribly. (save-excursion (goto-char point) (condition-case nil (funcall backward) (error nil)) (setq point (point)) (condition-case nil (funcall forward) (error nil)) (if (eq point (point)) (detach-extent mode-motion-extent) (set-extent-endpoints mode-motion-extent point (point)))) ;; not over text; zero the extent. (detach-extent mode-motion-extent))))))) (defun mode-motion-highlight-line (event) "For use as the value of `mode-motion-hook' -- highlight line under mouse." (mode-motion-highlight-internal event 'beginning-of-line 'end-of-line)) (defun mode-motion-highlight-word (event) "For use as the value of `mode-motion-hook' -- highlight word under mouse." (mode-motion-highlight-internal event #'(lambda () (default-mouse-track-beginning-of-word nil)) #'(lambda () (default-mouse-track-end-of-word nil)))) (defun mode-motion-highlight-symbol (event) "For use as the value of `mode-motion-hook' -- highlight symbol under mouse." (mode-motion-highlight-internal event #'(lambda () (default-mouse-track-beginning-of-word t)) #'(lambda () (default-mouse-track-end-of-word t)))) (defun mode-motion-highlight-sexp (event) "For use as the value of `mode-motion-hook' -- highlight form under mouse." (mode-motion-highlight-internal event #'(lambda () (if (= (char-syntax (following-char)) ?\() nil (goto-char (scan-sexps (point) -1)))) #'(lambda () (if (= (char-syntax (following-char)) ?\)) (forward-char 1)) (goto-char (scan-sexps (point) 1))))) (defun mode-motion-add-help-echo (event) "For use as the value of `mode-motion-hook' -- add a 'help-echo property. This causes the string in the 'help-echo property to be displayed when the mouse moves over the extent. See `mode-motion-help-echo-string' for documentation on how to control the string that is added." (mode-motion-ensure-extent-ok event) (let ((string (cond ((null mode-motion-help-echo-string) nil) ((stringp mode-motion-help-echo-string) mode-motion-help-echo-string) (t (funcall mode-motion-help-echo-string event))))) (if (stringp string) (set-extent-property mode-motion-extent 'help-echo string)))) (provide 'mode-motion) ;;; mode-motion.el ends here