Mercurial > emacs
annotate lisp/obsolete/levents.el @ 110523:a5ad4f188e19
Synch Semantic to CEDET 1.0.
Move CEDET ChangeLog entries to new file lisp/cedet/ChangeLog.
* semantic.el (semantic-version): Update to 2.0.
(semantic-mode-map): Add "," and "m" bindings.
(navigate-menu): Update.
* semantic/symref.el (semantic-symref-calculate-rootdir):
New function.
(semantic-symref-detect-symref-tool): Use it.
* semantic/symref/grep.el (semantic-symref-grep-shell): New var.
(semantic-symref-perform-search): Use it. Calculate root dir with
semantic-symref-calculate-rootdir.
(semantic-symref-derive-find-filepatterns): Improve error message.
* semantic/symref/list.el
(semantic-symref-results-mode-map): New bindings.
(semantic-symref-auto-expand-results): New option.
(semantic-symref-results-dump): Obey auto-expand.
(semantic-symref-list-expand-all, semantic-symref-regexp)
(semantic-symref-list-contract-all)
(semantic-symref-list-map-open-hits)
(semantic-symref-list-update-open-hits)
(semantic-symref-list-create-macro-on-open-hit)
(semantic-symref-list-call-macro-on-open-hits): New functions.
(semantic-symref-list-menu-entries)
(semantic-symref-list-menu): New vars.
(semantic-symref-list-map-open-hits): Move cursor to beginning of
match before calling the mapped function.
* semantic/doc.el
(semantic-documentation-comment-preceeding-tag): Do nothing if the
mode doesn't provide comment-start-skip.
* semantic/scope.el
(semantic-analyze-scope-nested-tags-default): Strip duplicates.
(semantic-analyze-scoped-inherited-tag-map): Take the tag we are
looking for as part of the scoped tags list.
* semantic/html.el (semantic-default-html-setup): Add
senator-step-at-tag-classes.
* semantic/decorate/include.el
(semantic-decoration-on-unknown-includes): Change light bgcolor.
(semantic-decoration-on-includes-highlight-default): Check that
the include tag has a postion.
* semantic/complete.el (semantic-collector-local-members):
(semantic-complete-read-tag-local-members)
(semantic-complete-jump-local-members): New class and functions.
(semantic-complete-self-insert): Save excursion before completing.
* semantic/analyze/complete.el
(semantic-analyze-possible-completions-default): If no completions
are found, return the raw by-name-only completion list. Add FLAGS
arguments. Add support for 'no-tc (type constraint) and
'no-unique, or no stripping duplicates.
(semantic-analyze-possible-completions-default): Add FLAGS arg.
* semantic/util-modes.el
(semantic-stickyfunc-show-only-functions-p): New option.
(semantic-stickyfunc-fetch-stickyline): Don't show stickytext for
the very first line in a buffer.
* semantic/util.el (semantic-hack-search)
(semantic-recursive-find-nonterminal-by-name)
(semantic-current-tag-interactive): Deleted.
(semantic-describe-buffer): Fix expand-nonterminal. Add
lex-syntax-mods, type relation separator char, and command
separation char.
(semantic-sanity-check): Only message if called interactively.
* semantic/tag.el (semantic-tag-deep-copy-one-tag): Copy the
:filename property and the tag position.
* semantic/lex-spp.el (semantic-lex-spp-lex-text-string):
Add recursion limit.
* semantic/imenu.el (semantic-imenu-bucketize-type-members):
Make this buffer local, not the obsoleted variable.
* semantic/idle.el: Add breadcrumbs support.
(semantic-idle-summary-current-symbol-info-default)
(semantic-idle-tag-highlight)
(semantic-idle-completion-list-default): Use
semanticdb-without-unloaded-file-searches for speed, and to
conform to the controls that specify if the idle timer is supposed
to be parsing unparsed includes.
(semantic-idle-symbol-highlight-face)
(semantic-idle-symbol-maybe-highlight): Rename from *-summary-*.
Callers changed.
(semantic-idle-work-parse-neighboring-files-flag): Default to nil.
(semantic-idle-work-update-headers-flag): New var.
(semantic-idle-work-for-one-buffer): Use it.
(semantic-idle-local-symbol-highlight): Rename from
semantic-idle-tag-highlight.
(semantic-idle-truncate-long-summaries): New option.
* semantic/ia.el (semantic-ia-cache)
(semantic-ia-get-completions): Deleted. Callers changed.
(semantic-ia-show-variants): New command.
(semantic-ia-show-doc): If doc is empty, don't make a temp buffer.
(semantic-ia-show-summary): If there isn't anything to show, say so.
* semantic/grammar.el (semantic-grammar-create-package):
Save the buffer even in batch mode.
* semantic/fw.el
(semanticdb-without-unloaded-file-searches): New macro.
* semantic/dep.el (semantic-dependency-find-file-on-path):
Fix case dereferencing ede-object when it is a list.
* semantic/db-typecache.el (semanticdb-expand-nested-tag)
(semanticdb-typecache-faux-namespace): New functions.
(semanticdb-typecache-file-tags)
(semanticdb-typecache-merge-streams): Use them.
(semanticdb-typecache-file-tags): When deriving tags from a file,
give the mode a chance to monkey with the tag copy.
(semanticdb-typecache-find-default): Wrap find in save-excursion.
(semanticdb-typecache-find-by-name-helper): Merge found names down.
* semantic/db-global.el
(semanticdb-enable-gnu-global-in-buffer): Don't show messages if
GNU Global is not available and we don't want to throw an error.
* semantic/db-find.el (semanticdb-find-result-nth-in-buffer):
When trying to normalize the tag to a buffer, don't error if
set-buffer method doesn't exist.
* semantic/db-file.el (semanticdb-save-db): Simplify msg.
* semantic/db.el (semanticdb-refresh-table): If forcing a
refresh on a file not in a buffer, use semantic-find-file-noselect
and delete the buffer after use.
(semanticdb-current-database-list): When calculating root via
hooks, force it through true-filename and skip the list of
possible roots.
* semantic/ctxt.el (semantic-ctxt-imported-packages): New.
* semantic/analyze/debug.el
(semantic-analyzer-debug-insert-tag): Reset standard output to
current buffer.
(semantic-analyzer-debug-global-symbol)
(semantic-analyzer-debug-missing-innertype): Change "prefix" to
"symbol" in messages.
* semantic/analyze/refs.el: (semantic-analyze-refs-impl)
(semantic-analyze-refs-proto): When calculating value, make sure
the found tag is 'similar' to the originating tag.
(semantic--analyze-refs-find-tags-with-parent): Attempt to
identify matches via imported symbols of parents.
(semantic--analyze-refs-full-lookup-with-parents): Do a deep
search during the brute search.
* semantic/analyze.el
(semantic-analyze-find-tag-sequence-default): Be robust to
calculated scopes being nil.
* semantic/bovine/c.el (semantic-c-describe-environment): Add
project macro symbol array.
(semantic-c-parse-lexical-token): Add recursion limit.
(semantic-ctxt-imported-packages, semanticdb-expand-nested-tag):
New overrides.
(semantic-expand-c-tag-namelist): Split a full type from a typedef
out to its own tag.
(semantic-expand-c-tag-namelist): Do not split out a typedef'd
inline type if it is an anonymous type.
(semantic-c-reconstitute-token): Use the optional initializers as
a clue that some function is probably a constructor. When
defining the type of these constructors, split the parent name,
and use only the class part, if applicable.
* semantic/bovine/c-by.el:
* semantic/wisent/python-wy.el: Regenerate.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 18 Sep 2010 22:49:54 -0400 |
parents | ed16fdd2685a |
children | 376148b31b5e |
rev | line source |
---|---|
105868
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1 ;;; levents.el --- emulate the Lucid event data type and associated functions |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
3 ;; Copyright (C) 1993, 2001, 2002, 2003, 2004, |
106815 | 4 ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
105868
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
5 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
6 ;; Maintainer: FSF |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
7 ;; Keywords: emulations |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
8 ;; Obsolete-since: 23.2 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
9 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
11 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
15 ;; (at your option) any later version. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
16 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
21 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
24 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
25 ;;; Commentary: |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
26 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
27 ;; Things we cannot emulate in Lisp: |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
28 ;; It is not possible to emulate current-mouse-event as a variable, |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
29 ;; though it is not hard to obtain the data from (this-command-keys). |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
30 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
31 ;; We do not have a variable unread-command-event; |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
32 ;; instead, we have the more general unread-command-events. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
33 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
34 ;; Our read-key-sequence and read-char are not precisely |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
35 ;; compatible with those in Lucid Emacs, but they should work ok. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
36 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
37 ;;; Code: |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
38 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
39 (defun next-command-event (event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
40 (error "You must rewrite to use `read-command-event' instead of `next-command-event'")) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
41 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
42 (defun next-event (event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
43 (error "You must rewrite to use `read-event' instead of `next-event'")) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
44 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
45 (defun dispatch-event (event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
46 (error "`dispatch-event' not supported")) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
47 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
48 ;; Make events of type eval, menu and timeout |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
49 ;; execute properly. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
50 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
51 (define-key global-map [menu] 'execute-eval-event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
52 (define-key global-map [timeout] 'execute-eval-event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
53 (define-key global-map [eval] 'execute-eval-event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
54 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
55 (defun execute-eval-event (event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
56 (interactive "e") |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
57 (funcall (nth 1 event) (nth 2 event))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
58 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
59 (put 'eval 'event-symbol-elements '(eval)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
60 (put 'menu 'event-symbol-elements '(eval)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
61 (put 'timeout 'event-symbol-elements '(eval)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
62 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
63 (defun allocate-event () |
107517
ed16fdd2685a
Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
64 "Return an empty event structure. |
105868
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
65 In this emulation, it returns nil." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
66 nil) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
67 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
68 (defun button-press-event-p (obj) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
69 "True if the argument is a mouse-button-press event object." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
70 (and (consp obj) (symbolp (car obj)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
71 (memq 'down (get (car obj) 'event-symbol-elements)))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
72 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
73 (defun button-release-event-p (obj) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
74 "True if the argument is a mouse-button-release event object." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
75 (and (consp obj) (symbolp (car obj)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
76 (or (memq 'click (get (car obj) 'event-symbol-elements)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
77 (memq 'drag (get (car obj) 'event-symbol-elements))))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
78 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
79 (defun button-event-p (obj) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
80 "True if the argument is a mouse-button press or release event object." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
81 (and (consp obj) (symbolp (car obj)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
82 (or (memq 'click (get (car obj) 'event-symbol-elements)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
83 (memq 'down (get (car obj) 'event-symbol-elements)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
84 (memq 'drag (get (car obj) 'event-symbol-elements))))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
85 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
86 (defun mouse-event-p (obj) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
87 "True if the argument is a mouse-button press or release event object." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
88 (and (consp obj) (symbolp (car obj)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
89 (or (eq (car obj) 'mouse-movement) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
90 (memq 'click (get (car obj) 'event-symbol-elements)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
91 (memq 'down (get (car obj) 'event-symbol-elements)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
92 (memq 'drag (get (car obj) 'event-symbol-elements))))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
93 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
94 (defun character-to-event (ch &optional event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
95 "Converts a numeric ASCII value to an event structure, replete with |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
96 bucky bits. The character is the first argument, and the event to fill |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
97 in is the second. This function contains knowledge about what the codes |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
98 mean -- for example, the number 9 is converted to the character Tab, |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
99 not the distinct character Control-I. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
100 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
101 Beware that character-to-event and event-to-character are not strictly |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
102 inverse functions, since events contain much more information than the |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
103 ASCII character set can encode." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
104 ch) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
105 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
106 (defun copy-event (event1 &optional event2) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
107 "Make a copy of the given event object. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
108 In this emulation, `copy-event' just returns its argument." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
109 event1) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
110 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
111 (defun deallocate-event (event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
112 "Allow the given event structure to be reused. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
113 In actual Lucid Emacs, you MUST NOT use this event object after |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
114 calling this function with it. You will lose. It is not necessary to |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
115 call this function, as event objects are garbage- collected like all |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
116 other objects; however, it may be more efficient to explicitly |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
117 deallocate events when you are sure that that is safe. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
118 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
119 This emulation does not actually deallocate or reuse events |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
120 except via garbage collection and `cons'." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
121 nil) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
122 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
123 (defun enqueue-eval-event: (function object) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
124 "Add an eval event to the back of the queue. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
125 It will be the next event read after all pending events." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
126 (setq unread-command-events |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
127 (nconc unread-command-events |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
128 (list (list 'eval function object))))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
129 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
130 (defun eval-event-p (obj) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
131 "True if the argument is an eval or menu event object." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
132 (eq (car-safe obj) 'eval)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
133 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
134 (defun event-button (event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
135 "Return the button-number of the given mouse-button-press event." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
136 (let ((sym (car (get (car event) 'event-symbol-elements)))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
137 (cdr (assq sym '((mouse-1 . 1) (mouse-2 . 2) (mouse-3 . 3) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
138 (mouse-4 . 4) (mouse-5 . 5)))))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
139 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
140 (defun event-function (event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
141 "Return the callback function of the given timeout, menu, or eval event." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
142 (nth 1 event)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
143 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
144 (defun event-key (event) |
107517
ed16fdd2685a
Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
145 "Return the KeySym of the given key-press event. |
105868
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
146 The value is an ASCII printing character (not upper case) or a symbol." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
147 (if (symbolp event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
148 (car (get event 'event-symbol-elements)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
149 (let ((base (logand event (1- (lsh 1 18))))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
150 (downcase (if (< base 32) (logior base 64) base))))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
151 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
152 (defun event-object (event) |
107517
ed16fdd2685a
Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
153 "Return the function argument of the given timeout, menu, or eval event." |
105868
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
154 (nth 2 event)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
155 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
156 (defun event-point (event) |
107517
ed16fdd2685a
Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
157 "Return the character position of the given mouse-related event. |
105868
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
158 If the event did not occur over a window, or did |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
159 not occur over text, then this returns nil. Otherwise, it returns an index |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
160 into the buffer visible in the event's window." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
161 (posn-point (event-end event))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
162 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
163 ;; Return position of start of line LINE in WINDOW. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
164 ;; If LINE is nil, return the last position |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
165 ;; visible in WINDOW. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
166 (defun event-closest-point-1 (window &optional line) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
167 (let* ((total (- (window-height window) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
168 (if (window-minibuffer-p window) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
169 0 1))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
170 (distance (or line total))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
171 (save-excursion |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
172 (goto-char (window-start window)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
173 (if (= (vertical-motion distance) distance) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
174 (if (not line) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
175 (forward-char -1))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
176 (point)))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
177 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
178 (defun event-closest-point (event &optional start-window) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
179 "Return the nearest position to where EVENT ended its motion. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
180 This is computed for the window where EVENT's motion started, |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
181 or for window WINDOW if that is specified." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
182 (or start-window (setq start-window (posn-window (event-start event)))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
183 (if (eq start-window (posn-window (event-end event))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
184 (if (eq (event-point event) 'vertical-line) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
185 (event-closest-point-1 start-window |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
186 (cdr (posn-col-row (event-end event)))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
187 (if (eq (event-point event) 'mode-line) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
188 (event-closest-point-1 start-window) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
189 (event-point event))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
190 ;; EVENT ended in some other window. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
191 (let* ((end-w (posn-window (event-end event))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
192 (end-w-top) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
193 (w-top (nth 1 (window-edges start-window)))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
194 (setq end-w-top |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
195 (if (windowp end-w) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
196 (nth 1 (window-edges end-w)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
197 (/ (cdr (posn-x-y (event-end event))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
198 (frame-char-height end-w)))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
199 (if (>= end-w-top w-top) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
200 (event-closest-point-1 start-window) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
201 (window-start start-window))))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
202 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
203 (defun event-process (event) |
107517
ed16fdd2685a
Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
204 "Return the process of the given process-output event." |
105868
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
205 (nth 1 event)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
206 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
207 (defun event-timestamp (event) |
107517
ed16fdd2685a
Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
208 "Return the timestamp of the given event object. |
105868
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
209 In Lucid Emacs, this works for any kind of event. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
210 In this emulation, it returns nil for non-mouse-related events." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
211 (and (listp event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
212 (posn-timestamp (event-end event)))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
213 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
214 (defun event-to-character (event &optional lenient) |
107517
ed16fdd2685a
Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
215 "Return the closest ASCII approximation to the given event object. |
105868
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
216 If the event isn't a keypress, this returns nil. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
217 If the second argument is non-nil, then this is lenient in its |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
218 translation; it will ignore modifier keys other than control and meta, |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
219 and will ignore the shift modifier on those characters which have no |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
220 shifted ASCII equivalent (Control-Shift-A for example, will be mapped to |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
221 the same ASCII code as Control-A.) If the second arg is nil, then nil |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
222 will be returned for events which have no direct ASCII equivalent." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
223 (if (symbolp event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
224 (and lenient |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
225 (cdr (assq event '((backspace . 8) (delete . 127) (tab . 9) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
226 (return . 10) (enter . 10))))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
227 ;; Our interpretation is, ASCII means anything a number can represent. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
228 (if (integerp event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
229 event nil))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
230 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
231 (defun event-window (event) |
107517
ed16fdd2685a
Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
232 "Return the window of the given mouse-related event object." |
105868
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
233 (posn-window (event-end event))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
234 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
235 (defun event-x (event) |
107517
ed16fdd2685a
Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
236 "Return the X position in characters of the given mouse-related event." |
105868
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
237 (/ (car (posn-col-row (event-end event))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
238 (frame-char-width (window-frame (event-window event))))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
239 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
240 (defun event-x-pixel (event) |
107517
ed16fdd2685a
Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
241 "Return the X position in pixels of the given mouse-related event." |
105868
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
242 (car (posn-col-row (event-end event)))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
243 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
244 (defun event-y (event) |
107517
ed16fdd2685a
Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
245 "Return the Y position in characters of the given mouse-related event." |
105868
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
246 (/ (cdr (posn-col-row (event-end event))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
247 (frame-char-height (window-frame (event-window event))))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
248 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
249 (defun event-y-pixel (event) |
107517
ed16fdd2685a
Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
250 "Return the Y position in pixels of the given mouse-related event." |
105868
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
251 (cdr (posn-col-row (event-end event)))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
252 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
253 (defun key-press-event-p (obj) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
254 "True if the argument is a keyboard event object." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
255 (or (integerp obj) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
256 (and (symbolp obj) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
257 (get obj 'event-symbol-elements)))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
258 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
259 (defun menu-event-p (obj) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
260 "True if the argument is a menu event object." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
261 (eq (car-safe obj) 'menu)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
262 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
263 (defun motion-event-p (obj) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
264 "True if the argument is a mouse-motion event object." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
265 (eq (car-safe obj) 'mouse-movement)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
266 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
267 (defun read-command-event () |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
268 "Return the next keyboard or mouse event; execute other events. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
269 This is similar to the function `next-command-event' of Lucid Emacs, |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
270 but different in that it returns the event rather than filling in |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
271 an existing event object." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
272 (let (event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
273 (while (progn |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
274 (setq event (read-event)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
275 (not (or (key-press-event-p event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
276 (button-press-event-p event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
277 (button-release-event-p event) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
278 (menu-event-p event)))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
279 (let ((type (car-safe event))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
280 (cond ((eq type 'eval) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
281 (funcall (nth 1 event) (nth 2 event))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
282 ((eq type 'switch-frame) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
283 (select-frame (nth 1 event)))))) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
284 event)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
285 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
286 (defun process-event-p (obj) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
287 "True if the argument is a process-output event object. |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
288 GNU Emacs 19 does not currently generate process-output events." |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
289 (eq (car-safe obj) 'process)) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
290 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
291 (provide 'levents) |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
292 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
293 ;; arch-tag: a80c21da-69d7-46de-9cdb-5f68577b5525 |
b4d1d7858370
* emacs-lisp/lucid.el: Move to obsolete/lucid.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
294 ;;; levents.el ends here |