Mercurial > hg > xemacs-beta
view lisp/term/sup-mouse.el @ 4906:6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
-------------------- ChangeLog entries follow: --------------------
lisp/ChangeLog addition:
2010-02-01 Ben Wing <ben@xemacs.org>
* cl-extra.el:
* cl-extra.el (cl-string-vector-equalp): Removed.
* cl-extra.el (cl-bit-vector-vector-equalp): Removed.
* cl-extra.el (cl-vector-array-equalp): Removed.
* cl-extra.el (cl-hash-table-contents-equalp): Removed.
* cl-extra.el (equalp): Removed.
* cl-extra.el (cl-mapcar-many):
Comment out the whole `equalp' implementation for the moment;
remove once we're sure the C implementation works.
* cl-macs.el:
* cl-macs.el (equalp):
Simplify the compiler-macro for `equalp' -- once it's in C,
we don't need to try so hard to expand it.
src/ChangeLog addition:
2010-02-01 Ben Wing <ben@xemacs.org>
* abbrev.c (abbrev_match_mapper):
* buffer.h (CANON_TABLE_OF):
* buffer.h:
* editfns.c (Fchar_equal):
* minibuf.c (scmp_1):
* text.c (qxestrcasecmp_i18n):
* text.c (qxestrncasecmp_i18n):
* text.c (qxetextcasecmp):
* text.c (qxetextcasecmp_matching):
Create new macro CANONCASE that converts to a canonical mapping
and use it to do caseless comparisons instead of DOWNCASE.
* alloc.c:
* alloc.c (cons_equal):
* alloc.c (vector_equal):
* alloc.c (string_equal):
* bytecode.c (compiled_function_equal):
* chartab.c (char_table_entry_equal):
* chartab.c (char_table_equal):
* data.c (weak_list_equal):
* data.c (weak_box_equal):
* data.c (ephemeron_equal):
* device-msw.c (equal_devmode):
* elhash.c (hash_table_equal):
* events.c (event_equal):
* extents.c (properties_equal):
* extents.c (extent_equal):
* faces.c:
* faces.c (face_equal):
* faces.c (face_hash):
* floatfns.c (float_equal):
* fns.c:
* fns.c (bit_vector_equal):
* fns.c (plists_differ):
* fns.c (Fplists_eq):
* fns.c (Fplists_equal):
* fns.c (Flax_plists_eq):
* fns.c (Flax_plists_equal):
* fns.c (internal_equal):
* fns.c (internal_equalp):
* fns.c (internal_equal_0):
* fns.c (syms_of_fns):
* glyphs.c (image_instance_equal):
* glyphs.c (glyph_equal):
* glyphs.c (glyph_hash):
* gui.c (gui_item_equal):
* lisp.h:
* lrecord.h (struct lrecord_implementation):
* marker.c (marker_equal):
* number.c (bignum_equal):
* number.c (ratio_equal):
* number.c (bigfloat_equal):
* objects.c (color_instance_equal):
* objects.c (font_instance_equal):
* opaque.c (equal_opaque):
* opaque.c (equal_opaque_ptr):
* rangetab.c (range_table_equal):
* specifier.c (specifier_equal):
Add a `foldcase' param to the equal() method and use it to implement
`equalp' comparisons. Also add to plists_differ(), although we
don't currently use it here.
Rewrite internal_equalp(). Implement cross-type vector comparisons.
Don't implement our own handling of numeric promotion -- just use
the `=' primitive.
Add internal_equal_0(), which takes a `foldcase' param and calls
either internal_equal() or internal_equalp().
* buffer.h:
When given a 0 for buffer (which is the norm when functions don't
have a specific buffer available), use the current buffer's table,
not `standard-case-table'; otherwise the current settings are
ignored.
* casetab.c:
* casetab.c (set_case_table):
When handling old-style vectors of 256 in `set-case-table' don't
overwrite the existing table! Instead create a new table and
populate.
* device-msw.c (sync_printer_with_devmode):
* lisp.h:
* text.c (lisp_strcasecmp_ascii):
Rename lisp_strcasecmp to lisp_strcasecmp_ascii and use
lisp_strcasecmp_i18n for caseless comparisons in some places.
* elhash.c:
Delete unused lisp_string_hash and lisp_string_equal().
* events.h:
* keymap-buttons.h:
* keymap.h:
* keymap.c (keymap_lookup_directly):
* keymap.c (keymap_store):
* keymap.c (FROB):
* keymap.c (key_desc_list_to_event):
* keymap.c (describe_map_mapper):
* keymap.c (INCLUDE_BUTTON_ZERO):
New file keymap-buttons.h; use to handle buttons 1-26 in place of
duplicating code 26 times.
* frame-gtk.c (allocate_gtk_frame_struct):
* frame-msw.c (mswindows_init_frame_1):
Fix some comments about internal_equal() in redisplay that don't
apply any more.
* keymap-slots.h:
* keymap.c:
New file keymap-slots.h. Use it to notate the slots in a keymap
structure, similar to frameslots.h or coding-system-slots.h.
* keymap.c (MARKED_SLOT):
* keymap.c (keymap_equal):
* keymap.c (keymap_hash):
Implement.
tests/ChangeLog addition:
2010-02-01 Ben Wing <ben@xemacs.org>
* automated/case-tests.el:
* automated/case-tests.el (uni-mappings):
* automated/search-tests.el:
Delete old pristine-case-table code. Rewrite the Unicode torture
test to take into account whether overlapping mappings exist for
more than one character, and not doing the upcase/downcase
comparisons in such cases.
* automated/lisp-tests.el (foo):
* automated/lisp-tests.el (string-variable):
* automated/lisp-tests.el (featurep):
Replace Assert (equal ... with Assert-equal; same for other types
of equality. Replace some awkward equivalents of Assert-equalp
with Assert-equalp. Add lots of equalp tests.
* automated/case-tests.el:
* automated/regexp-tests.el:
* automated/search-tests.el:
Fix up the comments at the top of the files. Move rules about where
to put tests into case-tests.el.
* automated/test-harness.el:
* automated/test-harness.el (test-harness-aborted-summary-template): New.
* automated/test-harness.el (test-harness-from-buffer):
* automated/test-harness.el (batch-test-emacs):
Fix Assert-test-not. Create Assert-not-equal and variants.
Delete the doc strings from all these convenience functions to avoid
excessive repetition; instead use one copy in a comment.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Mon, 01 Feb 2010 01:02:40 -0600 |
parents | d682c0f82a71 |
children | 85bd42a1e544 308d34e9f07d |
line wrap: on
line source
;;; sup-mouse.el --- supdup mouse support for lisp machines ;; Copyright (C) Free Software Foundation 1985, 1986 ;; Author: Wolfgang Rupprecht ;; Maintainer: FSF ;; Created: 21 Nov 1986 ;; Keywords: hardware ;; (from code originally written by John Robinson@bbn for the bitgraph) ;; This file is part of GNU Emacs. ;; GNU Emacs 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 2, or (at your option) ;; any later version. ;; GNU Emacs 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 GNU Emacs; see the file COPYING. If not, write to ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. ;;; Code: ;;; User customization option: (defvar sup-mouse-fast-select-window nil "*Non-nil for mouse hits to select new window, then execute; else just select.") (defconst mouse-left 0) (defconst mouse-center 1) (defconst mouse-right 2) (defconst mouse-2left 4) (defconst mouse-2center 5) (defconst mouse-2right 6) (defconst mouse-3left 8) (defconst mouse-3center 9) (defconst mouse-3right 10) ;;; Defuns: (defun sup-window-edges (&optional win) (error "not implemented") (window-pixel-edges win)) (defun sup-mouse-report () "This function is called directly by the mouse, it parses and executes the mouse commands. L move point * |---- These apply for mouse click in a window. 2L delete word | 3L copy word | If sup-mouse-fast-select-window is nil, C move point and yank * | just selects that window. 2C yank pop | R set mark * | 2R delete region | 3R copy region | on modeline on \"scroll bar\" in minibuffer L scroll-up line to top execute-extended-command C proportional goto-char line to middle mouse-help R scroll-down line to bottom eval-expression" (interactive) (let* ;; expect a string of <esc>:<buttons>;<x-pos>;<y-pos>c ((buttons (sup-get-tty-num ?\;)) (x (sup-get-tty-num ?\;)) (y (sup-get-tty-num ?c)) (window (sup-pos-to-window x y)) (edges (sup-window-edges window)) (old-window (selected-window)) (in-minibuf-p (eq y (1- (frame-height)))) (same-window-p (and (not in-minibuf-p) (eq window old-window))) (in-modeline-p (eq y (1- (nth 3 edges)))) (in-scrollbar-p (>= x (1- (nth 2 edges))))) (setq x (- x (nth 0 edges))) (setq y (- y (nth 1 edges))) ; (error "mouse-hit %d %d %d" buttons x y) ;;;; debug (cond (in-modeline-p (select-window window) (cond ((= buttons mouse-left) (scroll-up)) ((= buttons mouse-right) (scroll-down)) ((= buttons mouse-center) (goto-char (/ (* x (- (point-max) (point-min))) (1- (window-width)))) (beginning-of-line) (what-cursor-position))) (select-window old-window)) (in-scrollbar-p (select-window window) (scroll-up (cond ((= buttons mouse-left) y) ((= buttons mouse-right) (+ y (- 2 (window-height)))) ((= buttons mouse-center) (/ (+ 2 y y (- (window-height))) 2)) (t 0))) (select-window old-window)) (same-window-p (cond ((= buttons mouse-left) (sup-move-point-to-x-y x y)) ((= buttons mouse-2left) (sup-move-point-to-x-y x y) (kill-word 1)) ((= buttons mouse-3left) (sup-move-point-to-x-y x y) (save-excursion (copy-region-as-kill (point) (progn (forward-word 1) (point)))) (setq this-command 'yank) ) ((= buttons mouse-right) (push-mark) (sup-move-point-to-x-y x y) (exchange-point-and-mark)) ((= buttons mouse-2right) (push-mark) (sup-move-point-to-x-y x y) (kill-region (mark) (point))) ((= buttons mouse-3right) (push-mark) (sup-move-point-to-x-y x y) (copy-region-as-kill (mark) (point)) (setq this-command 'yank)) ((= buttons mouse-center) (sup-move-point-to-x-y x y) (setq this-command 'yank) (yank)) ((= buttons mouse-2center) (yank-pop 1)) ) ) (in-minibuf-p (cond ((= buttons mouse-right) (call-interactively 'eval-expression)) ((= buttons mouse-left) (call-interactively 'execute-extended-command)) ((= buttons mouse-center) (describe-function 'sup-mouse-report)); silly self help )) (t ;in another window (select-window window) (cond ((not sup-mouse-fast-select-window)) ((= buttons mouse-left) (sup-move-point-to-x-y x y)) ((= buttons mouse-right) (push-mark) (sup-move-point-to-x-y x y) (exchange-point-and-mark)) ((= buttons mouse-center) (sup-move-point-to-x-y x y) (setq this-command 'yank) (yank)) )) ))) (defun sup-get-tty-num (term-char) "Read from terminal until TERM-CHAR is read, and return intervening number. Upon non-numeric not matching TERM-CHAR signal an error." (let ((num 0) (char (read-char))) (while (and (>= char ?0) (<= char ?9)) (setq num (+ (* num 10) (- char ?0))) (setq char (read-char))) (or (eq term-char char) (error "Invalid data format in mouse command")) num)) (defun sup-move-point-to-x-y (x y) "Position cursor in window coordinates. X and Y are 0-based character positions in the window." (move-to-window-line y) (move-to-column x) ) (defun sup-pos-to-window (x y) "Find window corresponding to frame coordinates. X and Y are 0-based character positions on the frame." (let ((edges (sup-window-edges)) (window nil)) (while (and (not (eq window (selected-window))) (or (< y (nth 1 edges)) (>= y (nth 3 edges)) (< x (nth 0 edges)) (>= x (nth 2 edges)))) (setq window (next-window window)) (setq edges (sup-window-edges window)) ) (or window (selected-window)) ) ) ;;; sup-mouse.el ends here