[PATCH] Bind the mouse wheel by default
17 years, 3 months
Aidan Kehoe
Myself, I’m tired of the mouse wheel provoking errors on -vanilla
invocations.
lisp/ChangeLog addition:
2007-12-04 Aidan Kehoe <kehoea(a)parhasard.net>
* keydefs.el:
Bind mouse wheel movements by default, to a lambda that calls the
autoloaded #'mwheel-install and then #'mwheel-scrool with the
appropriate event.
XEmacs Trunk source patch:
Diff command: cvs -q diff -Nu
Files affected: lisp/keydefs.el
===================================================================
RCS
Index: lisp/keydefs.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/keydefs.el,v
retrieving revision 1.19
diff -u -u -r1.19 keydefs.el
--- lisp/keydefs.el 2006/08/06 22:14:10 1.19
+++ lisp/keydefs.el 2007/12/04 21:02:16
@@ -674,4 +674,12 @@
;(define-key global-map 'insertchar 'function-key-error)
(define-key global-map 'deletechar 'delete-char)
+;; Bind the mouse wheel by default.
+(dolist (keyspec '([(mouse-4)] [(shift mouse-4)] [(control mouse-4)]
+ [(mouse-5)] [(shift mouse-5)] [(control mouse-5)]))
+ (define-key global-map keyspec
+ #'(lambda (event)
+ (interactive "e")
+ (mwheel-install)
+ (declare-fboundp (mwheel-scroll event)))))
;;; keydefs.el ends here
--
¿Dónde estará ahora mi sobrino Yoghurtu Nghé, que tuvo que huir
precipitadamente de la aldea por culpa de la escasez de rinocerontes?
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
commit: Bind mouse wheel movements by default,
17 years, 3 months
Aidan Kehoe
changeset: 4315:26ec8d0f3a9c94369ce38325ef9ee3dd844a9827
tag: tip
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Sat Dec 08 13:18:49 2007 +0100
files: lisp/ChangeLog lisp/keydefs.el
description:
Bind mouse wheel movements by default,
to a lambda that calls the autoloaded #'mwheel-install and then
#'mwheel-scrool with the appropriate event.
diff -r f95358fda5d865d6cbf4ebf58957a2ccb2b9192d -r 26ec8d0f3a9c94369ce38325ef9ee3dd844a9827 lisp/ChangeLog
--- a/lisp/ChangeLog Fri Dec 07 13:32:19 2007 -0500
+++ b/lisp/ChangeLog Sat Dec 08 13:18:49 2007 +0100
@@ -1,3 +1,10 @@ 2007-12-07 Vin Shelton <acs(a)xemacs.org
+2007-12-04 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * keydefs.el:
+ Bind mouse wheel movements by default, to a lambda that calls the
+ autoloaded #'mwheel-install and then #'mwheel-scrool with the
+ appropriate event.
+
2007-12-07 Vin Shelton <acs(a)xemacs.org>
* about.el: Minor bio update to test hg repository.
diff -r f95358fda5d865d6cbf4ebf58957a2ccb2b9192d -r 26ec8d0f3a9c94369ce38325ef9ee3dd844a9827 lisp/keydefs.el
--- a/lisp/keydefs.el Fri Dec 07 13:32:19 2007 -0500
+++ b/lisp/keydefs.el Sat Dec 08 13:18:49 2007 +0100
@@ -674,4 +674,12 @@ Keymap for characters following C-c.")
;(define-key global-map 'insertchar 'function-key-error)
(define-key global-map 'deletechar 'delete-char)
+;; Bind the mouse wheel by default.
+(dolist (keyspec '([(mouse-4)] [(shift mouse-4)] [(control mouse-4)]
+ [(mouse-5)] [(shift mouse-5)] [(control mouse-5)]))
+ (define-key global-map keyspec
+ #'(lambda (event)
+ (interactive "e")
+ (mwheel-install)
+ (declare-fboundp (mwheel-scroll event)))))
;;; keydefs.el ends here
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
commit: Minor bio update to test new hg repository
17 years, 3 months
Vin Shelton
changeset: 4314:f95358fda5d865d6cbf4ebf58957a2ccb2b9192d
tag: tip
user: Vin Shelton <acs(a)xemacs.org>
date: Fri Dec 07 13:32:19 2007 -0500
files: lisp/ChangeLog lisp/about.el
description:
Minor bio update to test new hg repository
diff -r 0d2e738dfcd07adcc7000e7e5eb1bb77898ad6af -r f95358fda5d865d6cbf4ebf58957a2ccb2b9192d lisp/ChangeLog
--- a/lisp/ChangeLog Fri Dec 07 09:35:09 2007 +0200
+++ b/lisp/ChangeLog Fri Dec 07 13:32:19 2007 -0500
@@ -1,3 +1,7 @@ 2007-12-05 Aidan Kehoe <kehoea@parhasa
+2007-12-07 Vin Shelton <acs(a)xemacs.org>
+
+ * about.el: Minor bio update to test hg repository.
+
2007-12-05 Aidan Kehoe <kehoea(a)parhasard.net>
* code-files.el (write-region):
diff -r 0d2e738dfcd07adcc7000e7e5eb1bb77898ad6af -r f95358fda5d865d6cbf4ebf58957a2ccb2b9192d lisp/about.el
--- a/lisp/about.el Fri Dec 07 09:35:09 2007 +0200
+++ b/lisp/about.el Fri Dec 07 13:32:19 2007 -0500
@@ -1485,7 +1485,7 @@ Cambridge, Massachusetts. I used to pla
Cambridge, Massachusetts. I used to play a lot of Ultimate (see\n")
(about-url-link 'vin nil "Visit the Ultimate Players Association homepage")
(widget-insert " for more details), but nowadays I'm a family man,
-so I spend a lot of time with my wife, Becky, and my son, Noah.\n"))
+so I spend a lot of time with my wife, Becky, and our son, Noah.\n"))
(viteno
(widget-insert
"\
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
commit: Forgotten ChangeLog entry for changesets 4311 and 4312.
17 years, 3 months
Ville Skyttä
changeset: 4313:0d2e738dfcd07adcc7000e7e5eb1bb77898ad6af
tag: tip
user: "Ville SkyttÀ <scop(a)xemacs.org>"
date: Fri Dec 07 09:35:09 2007 +0200
files: man/ChangeLog
description:
Forgotten ChangeLog entry for changesets 4311 and 4312.
diff -r 1094d6d400fb5ed5b2bfaf45ba7f559812235614 -r 0d2e738dfcd07adcc7000e7e5eb1bb77898ad6af man/ChangeLog
--- a/man/ChangeLog Fri Dec 07 00:02:53 2007 +0200
+++ b/man/ChangeLog Fri Dec 07 09:35:09 2007 +0200
@@ -1,3 +1,8 @@ 2007-11-28 Aidan Kehoe <kehoea@parhasa
+2007-12-07 Ville Skyttä <scop(a)xemacs.org>
+
+ * beta.texi, emodules.texi, term.texi, termcap.texi, texinfo.texi,
+ widget.texi, xemacs-faq.texi: Spelling fixes.
+
2007-11-28 Aidan Kehoe <kehoea(a)parhasard.net>
* internals/internals.texi (Ibytes and Ichars):
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
commit: Spelling fixes.
17 years, 3 months
Ville Skyttä
changeset: 4312:1094d6d400fb5ed5b2bfaf45ba7f559812235614
tag: tip
user: "Ville Skyttä <scop(a)xemacs.org>"
date: Fri Dec 07 00:02:53 2007 +0200
files: man/beta.texi man/emodules.texi man/term.texi man/termcap.texi man/texinfo.texi man/widget.texi
description:
Spelling fixes.
diff -r ee41a739fba39804612b72df9647d61dc032503d -r 1094d6d400fb5ed5b2bfaf45ba7f559812235614 man/beta.texi
--- a/man/beta.texi Thu Dec 06 23:35:22 2007 +0200
+++ b/man/beta.texi Fri Dec 07 00:02:53 2007 +0200
@@ -350,7 +350,7 @@ command.
@item
Run @code{configure}. If you are new, just consider running it with no
-options, to see if you can get a succesful build. When you are more
+options, to see if you can get a successful build. When you are more
experienced, you should put various flags in. Here is what we suggest:
@enumerate
@@ -424,7 +424,7 @@ compile with that are located in an unus
@end example
@item
-Depending on your build environment, consuder setting or not setting
+Depending on your build environment, consider setting or not setting
options for menubars, scrollbars, window systems, native sound, etc. If
you're not sure, leave them out and let configure do the auto-detection.
(If you get bugs compiling GTK, use @code{--with-gtk=no --with-gnome=no}.)
diff -r ee41a739fba39804612b72df9647d61dc032503d -r 1094d6d400fb5ed5b2bfaf45ba7f559812235614 man/emodules.texi
--- a/man/emodules.texi Thu Dec 06 23:35:22 2007 +0200
+++ b/man/emodules.texi Fri Dec 07 00:02:53 2007 +0200
@@ -990,7 +990,7 @@ function @code{my-function}, if it was d
function @code{my-function}, if it was defined as an interactive
function (which in this case it was).
-Thats all there is to defining and announcing new functions. The rules
+That's all there is to defining and announcing new functions. The rules
for what goes inside the functions, and how to write good modules, is
beyond the scope of this document. Please consult the @value{emacs}
internals manual for more details.
diff -r ee41a739fba39804612b72df9647d61dc032503d -r 1094d6d400fb5ed5b2bfaf45ba7f559812235614 man/term.texi
--- a/man/term.texi Thu Dec 06 23:35:22 2007 +0200
+++ b/man/term.texi Fri Dec 07 00:02:53 2007 +0200
@@ -34,7 +34,7 @@ This is some notes about the term Emacs
@end menu
The @code{term} package includes the major modes @code{term},
-@code{shell}, and @code{gud} (for running gbd or another debugger).
+@code{shell}, and @code{gud} (for running gdb or another debugger).
It is a replacement for the comint mode of Emacs 19,
as well as shell, gdb, terminal, and telnet modes.
The package works best with recent releases of Emacs 19,
diff -r ee41a739fba39804612b72df9647d61dc032503d -r 1094d6d400fb5ed5b2bfaf45ba7f559812235614 man/termcap.texi
--- a/man/termcap.texi Thu Dec 06 23:35:22 2007 +0200
+++ b/man/termcap.texi Fri Dec 07 00:02:53 2007 +0200
@@ -174,7 +174,7 @@ variables.@refill
variables.@refill
On Unix systems, there is often no such header file. Then you must
-explictly declare the variables as external. You can do likewise for
+explicitly declare the variables as external. You can do likewise for
the functions, or let them be implicitly declared and cast their
values from type @code{int} to the appropriate type.
@@ -487,7 +487,7 @@ immediately will be lost.
immediately will be lost.
To avoid this problem, we normally follow each display command with enough
-useless charaters (usually null characters) to fill up the time that the
+useless characters (usually null characters) to fill up the time that the
display command needs to execute. This does the job if the terminal throws
away null characters without using up space in the buffer (which most
terminals do). If enough padding is used, no output can ever be lost. The
@@ -912,7 +912,7 @@ tabs or newlines. These might cause tro
tabs or newlines. These might cause trouble: the null character because
@code{tputs} would think that was the end of the string, the tab because
the kernel or other software might expand it into spaces, and the newline
-becaue the kernel might add a carriage-return, or padding characters
+because the kernel might add a carriage-return, or padding characters
normally used for a newline. To prevent such problems, @code{tgoto} is
careful to avoid these characters. Here is how this works: if the target
cursor position value is such as to cause a problem (that is to say, zero,
@@ -3317,7 +3317,7 @@ String to terminate redirection of outpu
@item po
String to redirect further output to the printer.
@item pO
-String to redirect @var{n} characters ofoutput to the printer.
+String to redirect @var{n} characters of output to the printer.
@item ps
String to print the screen on the attached printer.
@item rc
diff -r ee41a739fba39804612b72df9647d61dc032503d -r 1094d6d400fb5ed5b2bfaf45ba7f559812235614 man/texinfo.texi
--- a/man/texinfo.texi Thu Dec 06 23:35:22 2007 +0200
+++ b/man/texinfo.texi Fri Dec 07 00:02:53 2007 +0200
@@ -141,7 +141,7 @@ This is Edition @value{edition} of the T
@end ifinfo
@c Here is a spare copy of the chapter menu entry descriptions,
-@c in case they are accidently deleted
+@c in case they are accidentally deleted
@ignore
Your rights.
Texinfo in brief.
@@ -11439,7 +11439,7 @@ commands, by delineating a region with t
commands, by delineating a region with the @code{@@tex} and @code{@@end
tex} commands. (The @code{@@tex} command also causes Info to ignore the
region, like the @code{@@iftex} command.) The sole exception is that
-@code{@@} chracter still introduces a command, so that @code{@@end tex}
+@code{@@} character still introduces a command, so that @code{@@end tex}
can be recognized properly.
@cindex Mathematical expressions
@@ -11978,7 +11978,7 @@ tex foo.texi
@TeX{} will produce a @dfn{DVI file} as well as several auxiliary
files containing information for indices, cross references, etc. The
DVI file (for @dfn{DeVice Independent} file) can be printed on virtually
-any printe (see the following sections).
+any printer (see the following sections).
@pindex texindex
The @code{tex} formatting command itself does not sort the indices; it
diff -r ee41a739fba39804612b72df9647d61dc032503d -r 1094d6d400fb5ed5b2bfaf45ba7f559812235614 man/widget.texi
--- a/man/widget.texi Thu Dec 06 23:35:22 2007 +0200
+++ b/man/widget.texi Fri Dec 07 00:02:53 2007 +0200
@@ -1541,7 +1541,7 @@ in @ref{Basic Types}.
@defun widget-create-child-and-convert parent type &rest args
As a child of @var{parent}, create a widget with type @var{type} and
-value @var{value}. @var{type} is copied, and the @code{:widget-contvert}
+value @var{value}. @var{type} is copied, and the @code{:widget-convert}
method is applied to the optional keyword arguments from @var{args}.
@end defun
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
commit: Spelling fixes.
17 years, 3 months
Ville Skyttä
changeset: 4311:ee41a739fba39804612b72df9647d61dc032503d
tag: tip
user: "Ville SkyttÀ <scop(a)xemacs.org>"
date: Thu Dec 06 23:35:22 2007 +0200
files: man/xemacs-faq.texi
description:
Spelling fixes.
diff -r a6d7e031a10ba1227d078f2fc7fa921bd868250b -r ee41a739fba39804612b72df9647d61dc032503d man/xemacs-faq.texi
--- a/man/xemacs-faq.texi Thu Dec 06 20:10:16 2007 +0100
+++ b/man/xemacs-faq.texi Thu Dec 06 23:35:22 2007 +0200
@@ -823,7 +823,7 @@ Gutters, tabs: andy piper
@item Device subsystems
@itemize @minus
@item
-X Windows: Jamie Zawinksi, Ben Wing, others
+X Windows: Jamie Zawinski, Ben Wing, others
@item
GTK: William Perry, Malcolm Purvis
@item
@@ -887,7 +887,7 @@ mailing lists.
@item
Steve Youngs currently produces the beta releases (???).
@item
-Steve Youngs, Ville Skytta, and now Norbert Koch have taken turns
+Steve Youngs, Ville Skyttä, and now Norbert Koch have taken turns
maintaining the packages.
@item
Vin Shelton maintains the stable releases.
@@ -3290,7 +3290,7 @@ Note that XEmacs finds the packages auto
Note that XEmacs finds the packages automatically anywhere underneath
the directory tree where it expects to find the packages. All you
need to do is put stuff there; you don't need to run any program to
-tell XEmacs to find the packges, or do anything of that sort.
+tell XEmacs to find the packages, or do anything of that sort.
However, XEmacs will only notice newly installed packages when it
starts up, so you will have to restart if you are already running
@@ -3441,10 +3441,10 @@ keyb: x
As the exact files and their locations contained in a package may
change it is recommended to remove a package first before installing a
-new version. In order to facilitate removal each package contains an
-pgkinfo/MANIFEST.pkgname file which list all the files belong to the
-package. M-x package-admin-delete-binary-package RET can be used to
-remove a package using this file.
+new version. In order to facilitate removal each package contains a
+pkginfo/MANIFEST.pkgname file which lists all the files belonging to
+the package. M-x package-admin-delete-binary-package RET can be used
+to remove a package using this file.
Note that the interactive package tools included with XEmacs already do
this for you.
@@ -3536,7 +3536,7 @@ default. A good place to put @file{site
A typical error: FTP Error: USER request failed; 500 AUTH not understood.
-Thanks to giacomo boffi @email{giacomo.boffi@(a)polimi.it} who recommends
+Thanks to Giacomo Boffi @email{giacomo.boffi@(a)polimi.it} who recommends
on comp.emacs.xemacs:
tell your ftp client to not attempt AUTH authentication (or do not
@@ -7159,7 +7159,7 @@ John.@email{Cooper@(a)Eng.Sun.COM, John S
@node Q6.1.6, Q6.2.1, Q6.1.5, Internet
@unnumberedsubsec Q6.1.6: Customization of VM not covered in the manual, or here.
-@email{boffi@(a)hp735.stru.polimi.it, giacomo boffi} writes:
+@email{boffi@(a)hp735.stru.polimi.it, Giacomo Boffi} writes:
@quotation
The meta-answer is to look into the file @file{vm-vars.el}, in the vm
@@ -7350,7 +7350,7 @@ front of the load-path, the other at the
(setq load-path (nconc load-path '("foo" "bar")))
@end lisp
-@email{keithh@(a)nortel.ca, keith (k.p.) hanlan} writes:
+@email{keithh@(a)nortel.ca, Keith (k.p.) Hanlan} writes:
@quotation
To add directories using Unix shell metacharacters use
@@ -8289,7 +8289,7 @@ development branches, one "stable" and o
development branches, one "stable" and one "experimental". Periodic
releases happen in both branches, but those in the experimental branch
are not tested as well, and there's no guarantee they will work at all.
-The experiemental branch is open to any and all code that's acceptable
+The experimental branch is open to any and all code that's acceptable
to the developers; the stable branch, however, is in general limited
only to bug fixes, and all contributions are carefully reviewed to make
sure they will increase and not decrease stability.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[COMMIT] Import Simon Marshall's unique.el
17 years, 3 months
Aidan Kehoe
Okay, no good answers as to it going into core.
SUPERSEDES 18235.18556.38682.891293(a)parhasard.net
APPROVE COMMIT
NOTE: This patch has been committed.
xemacs-packages/elib/ChangeLog addition:
2007-12-06 Aidan Kehoe <kehoea(a)parhasard.net>
* unique.el:
Import Simon Marshall's unique.el. We use his code in
font-lock.el, and it is of general utility.
Add a couple of compiler macros for #'unique and #'uniq, to make
it possible to generate just byte code for common values for
PREDICATE.
Remove an unused variable from #'unique-reorder-buffer.
XEmacs Packages source patch:
Diff command: cvs -q diff -Nu
Files affected: xemacs-packages/elib/unique.el
===================================================================
RCS
Index: xemacs-packages/elib/unique.el
===================================================================
RCS file: unique.el
diff -N unique.el
--- /dev/null Thu Dec 6 22:14:27 2007
+++ unique.el Thu Dec 6 22:14:28 2007
@@ -0,0 +1,424 @@
+;;; unique.el --- functions and commands to uniquify
+
+;; Copyright (C) 1994 Simon Marshall.
+
+;; Author: Simon Marshall <Simon.Marshall(a)mail.esrin.esa.it>
+;; Keywords: unix unique
+;; Version: 1.01
+
+;; LCD Archive Entry:
+;; unique|Simon Marshall|Simon.Marshall(a)mail.esrin.esa.it|
+;; Functions and commands to uniquify lists or buffer text (cf. sort).|
+;; 28-Jun-1994|1.01|~/misc/unique.el.Z|
+;; The archive is archive.cis.ohio-state.edu in /pub/gnu/emacs/elisp-archive.
+
+;;; This file is not part of GNU Emacs.
+
+;;; This program 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.
+
+;;; This program 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.
+
+;;; Commentary:
+
+;; Purpose:
+;;
+;; This package provides functions to uniquify lists, and commands to uniquify
+;; buffer text.
+
+;; Provided are uniquification functions `unique' and `uniq'. Their
+;; differences and relative performances are described below.
+;;
+;; The function `unique' takes the list to be uniquified and a destructor
+;; function as args. This function takes an element and list as args. It
+;; returns the list minus occurrences of the element. This destructor function
+;; is called for each item in the list to be uniquified, with the rest of the
+;; list, and `unique' is therefore polynomial (as a function of the square of
+;; the length of the list, i.e., it is quadratic) iff the destructor function
+;; never removes any items from the list.
+;;
+;; The function `uniq' takes the list to be uniquified and a comparator
+;; function as args. This function takes two elements. It returns non-nil if
+;; the two elements are equivalent, the latter duplicate is removed. This
+;; comparator function is called for each item in the list to be uniquified,
+;; except the last, and `uniq' is therefore polynomial (as a function of the
+;; length of the list, i.e., it is linear) iff the comparator function never
+;; returns non-nil (no items are removed from the list).
+;;
+;; For example, the uniquification function `unique':
+;;
+;; (unique '("a" "b" "b" "b" "c" "d" "d" "e") 'delete)
+;; => ("a" "b" "c" "d" "e")
+;;
+;; Note that non-adjacent duplicate items are removed too:
+;;
+;; (unique '("foo" "bar" "is" "fubar" "as" "well" "as" "foo" "bar") 'delete)
+;; => ("foo" "bar" "is" "fubar" "as" "well")
+;;
+;; If you want to remove all but the last duplicate, reverse the list before
+;; and after uniquification:
+;;
+;; (let ((list '("foo" "bar" "is" "fubar" "as" "well" "as" "foo" "bar")))
+;; (nreverse (unique (nreverse list) 'delete)))
+;; => ("is" "fubar" "well" "as" "foo" "bar")
+;;
+;; However, the uniquification function `uniq' only removes adjacent duplicate
+;; items, like the Un*x command "uniq":
+;;
+;; (uniq '("foo" "bar" "is" "fubar" "as" "well" "as" "foo" "bar")
+;; 'string-equal)
+;; => ("foo" "bar" "is" "fubar" "as" "well" "as" "foo" "bar")
+;;
+;; To work on non-adjacent duplicate items, you must sort the list first.
+;; However, using `sort' changes the order of the list and is relatively slow:
+;;
+;; (let ((list '("foo" "bar" "is" "fubar" "as" "well" "as" "foo" "bar")))
+;; (uniq (sort list 'string-lessp) 'string-equal))
+;; => ("as" "bar" "foo" "fubar" "is" "well")
+;;
+;; So why is it provided? Good question. If the list is already sorted, and
+;; most items are unique anyway, `uniq' is quicker than `unique'. See below.
+;;
+;; With strings:
+;;
+;; For example, running these functions on the list of one-character strings
+;; built from the file .../lisp/comint.el (89146 strings, 98 (0.11%) unique):
+;;
+;; `uniq' 6.0 s (pre-sorted) 0.008 s (pre-uniqed pre-sorted)
+;; `unique' 11.4 s 0.047 s (pre-uniqued)
+;; `sort' 43.8 s 0.013 s (pre-uniqed pre-sorted)
+;; 0.017 s (pre-uniqued)
+;; Speedup: 1.9x (0.23x incl. `sort')
+;;
+;; For example, running these functions on the list of word strings built from
+;; the file .../lisp/comint.el (12727 words, 2034 (16.0%) unique):
+;;
+;; `uniq' 0.78 s (pre-sorted) 0.14 s (pre-uniqed pre-sorted)
+;; `unique' 58.8 s 15.9 s (pre-uniqued)
+;; `sort' 4.80 s 0.440 s (pre-uniqed pre-sorted)
+;; 0.638 s (pre-uniqued)
+;; Speedup: 75x (10x incl. `sort')
+;;
+;; For example, running these functions on the list of lines built from
+;; the file .../lisp/comint.el (2073 lines, 1736 (83.7%) unique):
+;;
+;; `uniq' 0.14 s (pre-sorted) 0.12 s (pre-uniqed pre-sorted)
+;; `unique' 10.8 s 10.6 s (pre-uniqued)
+;; `sort' 0.65 s 0.356 s (pre-uniqed pre-sorted)
+;; 0.509 s (pre-uniqued)
+;; Speedup: 77x (14x incl. `sort')
+;;
+;; With numbers:
+;;
+;; For example, running these functions on a list of 1024 random integers in
+;; the interval [0, 102400) (typically 99.5% unique):
+;;
+;; `uniq' 0.066 s (pre-sorted)
+;; `unique' 0.841 s
+;; `sort' 0.277 s
+;; Speedup: 12.7x (2.45x incl. `sort')
+;;
+;; For example, running these functions on a list of 5120 random integers in
+;; the interval [0, 512000) (typically 99.5% unique):
+;;
+;; `uniq' 0.336 s (pre-sorted)
+;; `unique' 18.85 s
+;; `sort' 1.707 s
+;; Speedup: 56x (9.23x incl. `sort')
+;;
+;; For example, running these functions on a list of 10240 random integers in
+;; the interval [0, 1024000) (typically 99.5% unique):
+;;
+;; `uniq' 0.671 s (pre-sorted)
+;; `unique' 73.88 s
+;; `sort' 3.759 s
+;; Speedup: 110x (16.7x incl. `sort')
+;;
+;; Note how `uniq' runs in approximately linear time w.r.t. the length of the
+;; list (and `sort' is almost linear---probably n*log2(n)---see a book),
+;; whereas `unique' runs in approximately polynomial (square) time. Double the
+;; length of the list, quadruple the evaluation time. Therefore, if the list
+;; is almost entirely unique, the speedup of `uniq' (sorting excluded) over
+;; `unique' is almost the same as the increase in list size.
+;;
+;; From the above, we can see that rather than deciding when you should use
+;; `uniq' rather than `unique' it is the other way around (wibble). If (1) you
+;; care about list order and/or (2) you know that hardly any items are unique,
+;; then you should use `unique'. Otherwise, use `uniq' and `sort'.
+
+;; Provided are uniquification commands:
+;;
+;; `unique-lines' for the removal of duplicate lines, `unique-words' for words
+;; and `unique-sentences' for sentences. They can be invoked as extended
+;; commands or bound to keys:
+;;
+;; M-x unique-lines
+;;
+;; (local-set-key "\C-cl" 'unique-lines)
+;;
+;; Typing C-c l invokes `unique-lines' on the currently selected region.
+
+;; Installation:
+;;
+;; To use, put in your package that uses these functions:
+;;
+;; (require 'unique)
+;;
+;; or autoload in your ~/.emacs the specific functions you require:
+;;
+;; (autoload 'unique "unique"
+;; "Uniquify LIST, deleting elements using PREDICATE.")
+;; (autoload 'uniq "unique"
+;; "Uniquify LIST, comparing adjacent elements using PREDICATE.")
+;;
+;; (autoload 'unique-lines "unique" "Uniquify lines in region." t)
+;; (autoload 'unique-words "unique" "Uniquify words in region." t)
+;; (autoload 'unique-sentences "unique" "Uniquify sentences in region." t)
+
+;; Feedback:
+;;
+;; This is hand written software. Use it at your own risk.
+;;
+;; Please send me bug reports, bug fixes, and extensions, so that I can
+;; merge them into the master source.
+;; - Simon Marshall (Simon.Marshall(a)mail.esrin.esa.it)
+;; Don't forget the version number of the package.
+
+;; History:
+;;
+;; - 1.00--1.01:
+;; Analysis of the performance of `uniq' (and `sort') vs. `unique'.
+;; Corrected Copyleft.
+
+;; Guts of the list-processing code
+
+(defun unique (list predicate)
+ "Uniquify LIST, deleting elements using PREDICATE.
+Return the list with subsequent duplicate items removed by side effects.
+PREDICATE is called with an element of LIST and a list of elements from LIST,
+and should return the list of elements with occurrences of the element removed.
+This function will work even if LIST is unsorted. See also `uniq'."
+ (let ((list list))
+ (while list
+ (setq list (setcdr list (funcall predicate (car list) (cdr list))))))
+ list)
+
+;; Were this file in core, the following compiler macro means it could
+;; replace font-lock-unique without any loss of performance.
+(define-compiler-macro unique (&whole form list predicate)
+ (if (not (and (and (consp predicate)
+ (or (eq (car predicate) 'quote)
+ (eq (car predicate) 'function))
+ (symbolp (cadr predicate)))))
+ form
+ `(let ((list ,list))
+ (let ((list list))
+ (while list
+ (setq list (setcdr list (,(cadr predicate) (car list) (cdr list))))))
+ list)))
+
+(defun uniq (list predicate)
+ "Uniquify LIST, comparing adjacent elements using PREDICATE.
+Return the list with adjacent duplicate items removed by side effects.
+PREDICATE is called with two elements of LIST, and should return non-nil if the
+first element is \"equal to\" the second.
+This function will only work as expected if LIST is sorted, as with the Un*x
+command of the same name. See also `sort' and `unique'."
+ (let ((list list))
+ (while list
+ (while (funcall predicate (car list) (nth 1 list))
+ (setcdr list (nthcdr 2 list)))
+ (setq list (cdr list))))
+ list)
+
+(define-compiler-macro uniq (&whole form list predicate)
+ (if (not (and (and (consp predicate)
+ (or (eq (car predicate) 'quote)
+ (eq (car predicate) 'function))
+ (symbolp (cadr predicate)))))
+ form
+ `(let ((list ,list))
+ (let ((list list))
+ (while (,(cadr predicate) (car list) (nth 1 list))
+ (setcdr list (nthcdr 2 list)))
+ (setq list (cdr list)))
+ list)))
+
+(defsubst delete-dups (list)
+ "Destructively remove `equal' duplicates from LIST.
+Store the result in LIST and return it. LIST must be a proper list.
+Of several `equal' occurrences of an element in LIST, the first
+one is kept."
+ (unique list #'equal))
+
+
+;; Guts of the buffer-processing code
+
+;; Might as well reuse as much code as we can. This is always the first sort
+;; function called.
+(autoload #'sort-build-lists "sort")
+
+(eval-when-compile
+ (require 'sort))
+
+(defvar unique-fold-case nil
+ "*Non-nil if the buffer unique functions should ignore case.")
+
+(defun unique-subr (nextrecfun endrecfun &optional startkeyfun endkeyfun)
+ "General text unique routine to divide buffer into records and uniquify them.
+Arguments are NEXTRECFUN ENDRECFUN and optional STARTKEYFUN ENDKEYFUN.
+
+We divide the accessible portion of the buffer into disjoint pieces called
+unique records (they are the same as sort records). A portion of each unique
+record (perhaps all of it) is designated as the unique key. The records are
+rearranged in the buffer by their unique keys. The records may or may not be
+contiguous.
+
+The four arguments are functions to be called to move point across a unique
+record. They will be called many times from within unique-subr.
+
+NEXTRECFUN is called with point at the end of the previous record. It moves
+point to the start of the next record. It should move point to the end of the
+buffer if there are no more records. The first record is assumed to start at
+the position of point when unique-subr is called.
+
+ENDRECFUN is called with point within the record. It should move point to the
+end of the record.
+
+STARTKEYFUN moves from the start of the record to the start of the key. It may
+return either a non-nil value to be used as the key, or else the key is the
+substring between the values of point after STARTKEYFUN and ENDKEYFUN are
+called. If STARTKEYFUN is nil, the key starts at the beginning of the record.
+
+ENDKEYFUN moves from the start of the unique key to the end of the unique key.
+ENDKEYFUN may be nil if STARTKEYFUN returns a value or if it would be the
+same as ENDRECFUN."
+ ;; Heuristically try to avoid messages if uniquifying a small amt of text.
+ (let ((messages (> (- (point-max) (point-min)) 10000))
+ (case-fold-search unique-fold-case) (unique-lists ()))
+ (save-excursion
+ (if messages (message "Finding unique keys..."))
+ (setq unique-lists (nreverse (sort-build-lists nextrecfun endrecfun
+ startkeyfun endkeyfun)))
+ (if (null unique-lists)
+ (if messages (message "Finding unique keys...none found"))
+ (if messages (message "Uniquifying records..."))
+ (setq unique-lists (unique unique-lists
+ (if (consp (car (car unique-lists)))
+ 'unique-delete-buffer-substrings
+ 'delete)))
+ (if messages (message "Reordering buffer..."))
+ (unique-reorder-buffer unique-lists)
+ (if messages (message "Reordering buffer...done"))))))
+
+(defun unique-delete-buffer-substrings (a blist)
+ ;; Return BLIST without occurrences of the text referred to by unique key A.
+ (let ((bl blist)
+ (unique-equal-buffer-substrings
+ ;; Is the text refered to by the unique keys A and B the same?
+ (function (lambda (a b) (zerop (compare-buffer-substrings
+ nil (car (car a)) (cdr (car a))
+ nil (car (car b)) (cdr (car b))))))))
+ (while bl
+ (while (funcall unique-equal-buffer-substrings a (nth 1 bl))
+ (setcdr bl (nthcdr 2 bl)))
+ (setq bl (cdr bl)))
+ (if (funcall unique-equal-buffer-substrings a (car blist))
+ (cdr blist)
+ blist)))
+
+(defun unique-reorder-buffer (unique-lists)
+ (let ((inhibit-quit t)
+ (last (point-min))
+ (min (point-min)) (max (point-max)))
+ ;; Make sure insertions done for reordering
+ ;; do not go after any markers at the end of the uniquified region,
+ ;; by inserting a space to separate them.
+ (goto-char (point-max))
+ (insert-before-markers " ")
+ (narrow-to-region min (1- (point-max)))
+ (while unique-lists
+ (goto-char (point-max))
+ (insert-buffer-substring (current-buffer)
+ (nth 1 (car unique-lists))
+ (1+ (cdr (cdr (car unique-lists)))))
+ (setq unique-lists (cdr unique-lists)))
+ ;; Delete the original copy of the text.
+ (delete-region min max)
+ ;; Get rid of the separator " ".
+ (goto-char (point-max))
+ (narrow-to-region min (1+ (point)))
+ (delete-region (point) (1+ (point)))))
+
+;;; Commands
+
+(defun unique-lines (beg end)
+ "Uniquify lines in region.
+Called from a program, there are two arguments: BEG and END (the region)."
+ (interactive "r")
+ (save-excursion
+ (save-restriction
+ (narrow-to-region beg end)
+ (goto-char (point-min))
+ (unique-subr 'forward-line 'end-of-line))))
+
+(defun unique-words (beg end)
+ "Uniquify words in region.
+Called from a program, there are two arguments: BEG and END (the region)."
+ (interactive "r")
+ (save-excursion
+ (save-restriction
+ (narrow-to-region beg end)
+ (goto-char (point-min))
+ (unique-subr (function (lambda () (skip-chars-forward "\n \t\f")))
+ (function (lambda () (forward-word 1)))))))
+
+(defun unique-sentences (beg end)
+ "Uniquify sentences in region.
+Called from a program, there are two arguments: BEG and END (the region)."
+ (interactive "r")
+ (save-excursion
+ (save-restriction
+ (narrow-to-region beg end)
+ (goto-char (point-min))
+ (unique-subr (function (lambda () (skip-chars-forward "\n \t\f")))
+ (function (lambda () (forward-sentence 1)
+ (or (zerop (skip-chars-forward "\n \t\f"))
+ (backward-char 1))))))))
+
+;;; Functions for emacs-18
+
+(or (fboundp 'delete)
+ (defun delete (elt list)
+ "Delete by side effect any occurrences of ELT as a member of LIST.
+The modified LIST is returned. Comparison is done with `equal'.
+If the first member of LIST is ELT there is no way to remove it by side effect;
+therefore, write `(setq foo (delete element foo))'
+to be sure of changing the value of `foo'."
+ (let ((list list))
+ (while list
+ (while (equal elt (nth 1 list))
+ (setcdr list (nthcdr 2 list)))
+ (setq list (cdr list))))
+ (if (equal elt (car list)) (cdr list) list)))
+
+;; Maybe one day `compare-buffer-substrings' too. But then again, maybe not.
+(or (fboundp 'compare-buffer-substrings)
+ (defun compare-buffer-substrings (buffer1 start1 end1 buffer2 start2 end2)
+ "In GNU Emacs 19 this function compares two substrings of two buffers."
+ (let ((version (emacs-version)))
+ (error "Function `compare-buffer-substrings' is not provided in %s"
+ (substring version 0 (string-match "\\.[0-9]+ " version))))))
+
+(provide 'unique)
+
+;;; unique.el ends here
--
¿Dónde estará ahora mi sobrino Yoghurtu Nghé, que tuvo que huir
precipitadamente de la aldea por culpa de la escasez de rinocerontes?
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[COMMIT] Use Stephen's suggested docstring for #'write-region
17 years, 3 months
Aidan Kehoe
APPROVE COMMIT
NOTE: This patch has been committed.
lisp/ChangeLog addition:
2007-12-05 Aidan Kehoe <kehoea(a)parhasard.net>
* code-files.el (write-region):
Use a more concise and probably less confusing docstring from
Stephen. See
87ve84323s.fsf(a)uwakimon.sk.tsukuba.ac.jp.
Not following his suggestion of keeping the CODING-SYSTEM name for
the last argument, given that that would make reworking the
body of the necessary, and that I introduced a short-lived bug the
last time I did that.
XEmacs Trunk source patch:
Diff command: cvs -q diff -Nu
Files affected: lisp/code-files.el
===================================================================
RCS
Index: lisp/code-files.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/code-files.el,v
retrieving revision 1.24
diff -u -u -r1.24 code-files.el
--- lisp/code-files.el 2007/11/15 15:24:24 1.24
+++ lisp/code-files.el 2007/12/05 19:19:10
@@ -513,42 +513,34 @@
FILENAME, APPEND, VISIT, LOCKNAME, and CODING-SYSTEM, the same as the
corresponding arguments in the call to `write-region'.")
-(defun write-region (start end filename
- &optional append visit lockname
+(defun write-region (start end filename &optional append visit lockname
coding-system-or-mustbenew)
"Write current region into specified file.
-By default the file's existing contents are replaced by the specified region.
-Called interactively, prompts for a file name. With a prefix arg, prompts
-for a coding system as well.
+Called interactively, prompts for a file name.
+With a prefix arg, prompts for a coding system as well.
When called from a program, takes three required arguments:
START, END and FILENAME. START and END are buffer positions.
-Optional fourth argument APPEND if non-nil means
- append to existing file contents (if any).
-Optional fifth argument VISIT if t means
- set last-save-file-modtime of buffer to this file's modtime
- and mark buffer not modified.
-If VISIT is a string, it is a second file name;
- the output goes to FILENAME, but the buffer is marked as visiting VISIT.
- VISIT is also the file name to lock and unlock for clash detection.
-If VISIT is neither t nor nil nor a string,
- that means do not print the \"Wrote file\" message.
-The optional sixth arg LOCKNAME, if non-nil, specifies the name to
- use for locking and unlocking, overriding FILENAME and VISIT.
-Kludgy feature: if START is a string, then that string is written
-to the file, instead of any buffer contents, and END is ignored.
+APPEND, if non-nil, means append to existing file contents (if any), else
+ the file's existing contents are replaced by the specified region.
+VISIT, if non-nil, should be a string naming a file. The buffer is marked
+ as visiting VISIT. VISIT is also the file name to lock
+ and unlock for clash detection.
+LOCKNAME, if non-nil, specifies the name to use for locking and unlocking,
+ overriding FILENAME and VISIT.
+CODING-SYSTEM-OR-MUSTBENEW specifies the coding system used to encode the
+ text written. It defaults to the value of `buffer-file-coding-system'
+ in the current buffer.
-Optional seventh argument CODING-SYSTEM-OR-MUSTBENEW has a rather kludgy
- interpretation. If it is a coding system it describes the coding system
- used to encode the text when it is written out, defaulting to to the value
- of `buffer-file-coding-system' in the current buffer.
-
-If CODING-SYSTEM-OR-MUSTBENEW is non-nil and not a coding system, it means
- that a check for an existing file with the same name should be made; with
- a value of 'excl XEmacs will error if the file already exists and never
- overwrite it. If it is some other non-nil non-coding-system value, the
- user will be asked for confirmation if the file already exists, and the
- file will be overwritten if confirmation is given.
+For compatibility with GNU Emacs, several arguments are overloaded:
+START may be a string, which is written to the file. END is ignored.
+VISIT may take the value t, meaning to set last-save-file-modtime of buffer
+ to this file's modtime and mark buffer not modified. With any other
+ non-nil value of VISIT, suppress printing of the \"Wrote file\" message.
+CODING-SYSTEM-OR-MUSTBENEW may be a non-nil, non-coding-system value.
+ If it is `excl' and FILENAME already exists, signal `file-already-exists'.
+ Otherwise, if FILENAME already exists, ask for confirmation before
+ writing, and signal `file-already-exists' if not confirmed.
See also `write-region-pre-hook' and `write-region-post-hook'."
(interactive "r\nFWrite region to file: \ni\ni\ni\nZCoding-system: ")
--
¿Dónde estará ahora mi sobrino Yoghurtu Nghé, que tuvo que huir
precipitadamente de la aldea por culpa de la escasez de rinocerontes?
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
Re: 21.5 screen resize issue
17 years, 3 months
Stephen J. Turnbull
APPROVE 21.5
Tested per Ron's message. This one is theoretically right, but so
unobviously correct that I think the only way to prove it is to commit
it.
Ron, do you have any reservations about having the log in your name
with your company affiliation?
Ron Isaacson writes:
> Ron Isaacson wrote:
> >
> > > I gotta get some sleep, but I think that moving the reset of
> > > size_changed_pending to the beginning of change_frame_size_1 might help.
> >
> > I agree. change_frame_size_1 is what actually effects the pending
> > change. I'll give it a try...
>
> Sure enough, that did it. Patch attached. And the screen(1) thing
> turned out to be a total red herring... it so happens that all of my
> console-mode usage is within screen, but the same problem happens
> without it. :-)
>
Index: src/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.1110
diff -u -U0 -r1.1110 ChangeLog
--- src/ChangeLog 29 Nov 2007 13:37:54 -0000 1.1110
+++ src/ChangeLog 4 Dec 2007 05:49:49 -0000
@@ -0,0 +1,6 @@
+2007-12-02 Ron Isaacson <ron.isaacson(a)morganstanley.com>
+
+ * frame.c (change_frame_size):
+ (change_frame_size_1):
+ Must reset pending flag per-frame, so do it in the latter.
+
Index: src/frame.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/frame.c,v
retrieving revision 1.76
diff -u -r1.76 frame.c
--- src/frame.c 3 Oct 2007 10:06:41 -0000 1.76
+++ src/frame.c 4 Dec 2007 05:49:54 -0000
@@ -3273,6 +3273,7 @@
default_face_height_and_width_1 (frame, &font_height, &font_width);
/* This size-change overrides any pending one for this frame. */
+ f->size_change_pending = 0;
FRAME_NEW_HEIGHT (f) = 0;
FRAME_NEW_WIDTH (f) = 0;
@@ -3450,7 +3451,6 @@
return;
}
- f->size_change_pending = 0;
/* For TTY frames, it's like one, like all ...
Can't have two TTY frames of different sizes on the same device. */
if (FRAME_TTY_P (f))
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[COMMIT] Fix make check in the presence of variant language environments
17 years, 3 months
Aidan Kehoe
APPROVE COMMIT
NOTE: This patch has been committed.
tests/ChangeLog addition:
2007-12-04 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/mule-tests.el (featurep):
The native coding system specified in the language environment can
be either a list (which we used to handle fine) or a single coding
system expression (which we failed on). Handle the latter case.
XEmacs Trunk source patch:
Diff command: cvs -q diff -Nu
Files affected: tests/automated/mule-tests.el
===================================================================
RCS
Index: tests/automated/mule-tests.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/tests/automated/mule-tests.el,v
retrieving revision 1.21
diff -u -u -r1.21 mule-tests.el
--- tests/automated/mule-tests.el 2007/11/29 13:38:21 1.21
+++ tests/automated/mule-tests.el 2007/12/04 20:39:54
@@ -548,6 +548,7 @@
(loop
for language in (mapcar #'car language-info-alist)
with language-input-method = nil
+ with native-coding-system = nil
do
;; s-l-e can call #'require, which says "Loading ..."
(Silence-Message (set-language-environment language))
@@ -577,8 +578,12 @@
(Assert (charsetp (find-charset charset))))
(dolist (coding-system (get-language-info language 'coding-system))
(Assert (coding-system-p (find-coding-system coding-system))))
- (dolist (coding-system (get-language-info language
- 'native-coding-system))
+ (dolist (coding-system
+ (if (listp (setq native-coding-system
+ (get-language-info language
+ 'native-coding-system)))
+ native-coding-system
+ (list native-coding-system)))
;; We don't have the appropriate POSIX locales to test with a
;; native-coding-system that is a function.
(unless (functionp coding-system)
--
¿Dónde estará ahora mi sobrino Yoghurtu Nghé, que tuvo que huir
precipitadamente de la aldea por culpa de la escasez de rinocerontes?
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches