Commit b70d23ff authored by Paul Eggert's avatar Paul Eggert

Merge from mainline.

parents 06c550d2 11043dbd
2011-04-05 Paul Eggert <>
2011-04-06 Paul Eggert <>
2011-04-01 Paul Eggert <>
Replace 2 copies of readlink code with 1 gnulib version (Bug#8401).
* (GNULIB_MODULES): Add careadlinkat.
* lib/allocator.h, lib/careadlinkat.c, lib/careadlinkat.h:
* m4/ssize_t.m4: New files, automatically generated from gnulib.
2011-04-06 Glenn Morris <>
* autogen/update_autogen: Handle loaddefs-like files as well.
(usage): Add -l, -C.
(clean, ldefs_flag, ldefs_in, ldefs_out): New variables.
With -l, check status of lisp/ as well.
With -C, clean before building.
(autoreconf): Only pass -f in the `clean' case.
(commit): New function.
2011-03-28 Glenn Morris <>
* autogen/update_autogen: Pass -f to autoreconf.
......@@ -25,6 +25,9 @@
## This is a helper script to update the pre-built generated files in
## the autogen/ directory. This is suitable for running from cron.
## Only Emacs maintainers need use this, so it uses bash features.
## With the -l option, it also updates the versioned loaddefs-like
## files in lisp/. These include ldefs-boot, cl-loaddefs, rmail, etc.
### Code:
......@@ -48,13 +51,17 @@ cd ../
usage ()
cat 1>&2 <<EOF
Usage: ${PN} [-f] [-c] [-q]
Usage: ${PN} [-f] [-c] [-q] [-l [-L]] [-C] [-- make-flags]
Update the generated files in the Emacs autogen/ directory.
-f: force an update even if the source files are locally modified.
-c: if the update succeeds and the generated files are modified,
commit them (caution).
-q: be quiet; only give error messages, not status messages.
-l: also update the versioned loaddefs-like files in lisp/.
This requires a build. Passes any non-option args to make (eg -- -j2).
-L: also update ldefs-boot.el.
-C: start from a clean state. Slower, but more correct.
exit 1
......@@ -65,8 +72,13 @@ EOF
## Parameters.
sources=" lib/"
genfiles="configure aclocal.m4 src/ lib/ compile config.guess config.sub depcomp install-sh missing"
......@@ -81,7 +93,7 @@ tempfile=/tmp/$PN.$$
trap "rm -f $tempfile 2> /dev/null" EXIT
while getopts ":hcfq" option ; do
while getopts ":hcflqCL" option ; do
case $option in
(h) usage ;;
......@@ -89,8 +101,14 @@ while getopts ":hcfq" option ; do
(f) force=1 ;;
(l) ldefs_flag=1 ;;
(q) quiet=1 ;;
(C) clean=1 ;;
(L) lboot_flag=1 ;;
(\?) die "Bad option -$OPTARG" ;;
(:) die "Option -$OPTARG requires an argument" ;;
......@@ -101,16 +119,17 @@ done
shift $(( --OPTIND ))
[ $# -eq 0 ] || die "Wrong number of arguments"
## Does not work 100% because a lot of Emacs batch output comes on stderr (?).
[ "$quiet" ] && exec 1> /dev/null
echo "Running bzr status..."
bzr status -S $sources >| $tempfile || die "bzr status error for sources"
bzr status -S $sources ${ldefs_flag:+lisp} >| $tempfile || \
die "bzr status error for sources"
## The lisp portion could be more permissive, eg only care about .el files.
while read stat file; do
case $stat in
......@@ -124,9 +143,21 @@ while read stat file; do
done < $tempfile
## Probably this is overkill, and there's no need to "bootstrap" just
## for making autoloads.
[ "$clean" ] && {
echo "Running 'make maintainer-clean'..."
make maintainer-clean #|| die "Cleaning error"
rm -f $ldefs_in
echo "Running autoreconf..."
autoreconf -f -i -I m4 2>| $tempfile
autoreconf ${clean:+-f} -i -I m4 2>| $tempfile
......@@ -162,27 +193,111 @@ while read stat file; do
done < $tempfile
[ "$modified" ] || {
echo "No files were modified"
exit 0
cd ../
## Uses global $commit.
commit ()
local type=$1
[ $# -gt 0 ] || {
echo "No files were modified"
return 0
echo "Modified file(s): $@"
[ "$commit" ] || return 0
echo "Committing..."
## bzr status output is always relative to top-level, not PWD.
bzr commit -m "Auto-commit of $type files." "$@" || return $?
echo "Committed files: $@"
} # function commit
commit "generated" $modified || die "bzr commit error"
[ "$ldefs_flag" ] || exit 0
echo "Finding loaddef targets..."
sed -n -e '/^AUTOGEN_VCS/,/^$/ s/\\//p' lisp/ | \
sed '/AUTOGEN_VCS/d' >| $tempfile || die "sed error"
while read genfile; do
[ -r lisp/$genfile ] || die "Unable to read $genfile"
genfiles="$genfiles $genfile"
done < $tempfile
[ "$genfiles" ] || die "Error setting genfiles"
[ -e Makefile ] || {
echo "Running ./configure..."
## Minimize required packages.
./configure --without-x || die "configure error"
echo "Modified file(s): $modified"
[ "$commit" ] || exit 0
## Build the minimum needed to get the autoloads.
echo "Running lib/ make..."
make -C lib "$@" all || die "make lib error"
echo "Running src/ make..."
make -C src "$@" bootstrap-emacs || die "make src error"
echo "Running lisp/ make..."
make -C lisp "$@" autoloads EMACS=../src/bootstrap-emacs || die "make src error"
[ ! "$lboot_flag" ] || cp $ldefs_in $ldefs_out || die "cp ldefs_boot error"
cd lisp
echo "Checking status of loaddef files..."
## It probably would be fine to just check+commit lisp/, since
## making autoloads should not effect any other files. But better
## safe than sorry.
bzr status -S $genfiles ${ldefs_out#lisp/} >| $tempfile || \
die "bzr status error for generated files"
while read stat file; do
[ "$stat" != "M" ] && die "Unexpected status ($stat) for generated $file"
modified="$modified $file"
done < $tempfile
echo "Committing..."
## bzr status output is annoyingly always relative to top-level, not PWD.
cd ../
bzr commit -m "Auto-commit of generated files." $modified || \
die "bzr commit error"
commit "loaddefs" $modified || die "bzr commit error"
echo "Committed files: $modified"
exit 0
### update_autogen ends here
2011-04-06 Glenn Morris <>
* (AUTOGEN_VCS): New variable.
(autoloads): Use $AUTOGEN_VCS.
* calendar/cal-move.el (calendar-scroll-toolkit-scroll): New function.
* calendar/calendar.el (calendar-mode-map):
Check for toolkit scroll bars. (Bug#8305)
2011-04-05 Chong Yidong <>
* minibuffer.el (completion-in-region--postch)
(completion-in-region-mode): Remove unnecessary messages.
2011-04-05 Juanma Barranquero <>
* font-lock.el (font-lock-refresh-defaults):
Don't bind `hi-lock--inhibit-font-lock-hook', removed in
2010-10-09T04:09:19Z! and 2010-10-11T23:57:49Z! (2010-10-12).
* info.el (Info-directory-list, Info-read-node-name-2)
(Info-split-parameter-string): Doc fixes.
(Info-virtual-nodes): Reflow docstring.
(Info-find-file, Info-directory-toc-nodes, Info-history-toc-nodes)
(Info-apropos-toc-nodes, info-finder, Info-get-token)
(Info-find-emacs-command-nodes, Info-speedbar-key-map):
Fix typos in docstrings.
(Info-revert-buffer-function, Info-search, Info-isearch-pop-state)
(Info-speedbar-hierarchy-buttons, Info-speedbar-goto-node)
(Info-speedbar-buttons, Info-desktop-buffer-misc-data)
(Info-restore-desktop-buffer): Mark unused parameters.
(Info-directory-find-file, Info-directory-find-node)
(Info-history-find-file, Info-history-find-node, Info-toc-find-node)
(Info-virtual-index-find-node, Info-apropos-find-file)
(Info-apropos-find-node, Info-finder-find-file, Info-finder-find-node):
Mark unused parameters; fix typos in docstrings.
(Info-virtual-index): Remove unused local variable `nodename'.
2011-04-05 Deniz Dogan <>
* net/rcirc.el: Update my e-mail address.
......@@ -70,6 +70,18 @@ AUTOGENEL = loaddefs.el \
cedet/ede/loaddefs.el \
# Versioned files that are the value of someone's `generated-autoload-file'.
# Note that update_loaddefs parses this.
ps-print.el \
emulation/tpu-edt.el \
emacs-lisp/cl-loaddefs.el \
mail/rmail.el \
dired.el \
ibuffer.el \
htmlfontify.el \
# Value of max-lisp-eval-depth when compiling initially.
# During bootstrapping the byte-compiler is run interpreted when compiling
# itself, and uses more stack than usual.
......@@ -153,13 +165,9 @@ finder-data: doit
echo Directories: $$wins; \
$(emacs) -l finder --eval '(setq generated-finder-keywords-file "$(lisp)/finder-inf.el")' -f finder-compile-keywords-make-dist $$wins
# The chmod +w is to handle env var CVSREAD=1. Files named
# are identified by being the value of `generated-autoload-file'.
# The chmod +w is to handle env var CVSREAD=1.
autoloads: $(LOADDEFS) doit
chmod +w $(lisp)/ps-print.el $(lisp)/emulation/tpu-edt.el \
$(lisp)/emacs-lisp/cl-loaddefs.el $(lisp)/mail/rmail.el \
$(lisp)/dired.el $(lisp)/ibuffer.el $(lisp)/htmlfontify.el \
cd $(lisp) && chmod +w $(AUTOGEN_VCS)
cd $(lisp); $(setwins_almost); \
echo Directories: $$wins; \
$(emacs) -l autoload --eval '(setq generated-autoload-file "$(lisp)/loaddefs.el")' -f batch-update-autoloads $$wins
......@@ -204,6 +204,18 @@ EVENT is an event like `last-nonmenu-event'."
(define-obsolete-function-alias 'scroll-calendar-left-three-months
'calendar-scroll-left-three-months "23.1")
;; cf scroll-bar-toolkit-scroll
(defun calendar-scroll-toolkit-scroll (event)
"Function to scroll the calendar after a toolkit scroll-bar click."
(interactive "e")
(let ((part (nth 4 (event-end event))))
;; Not bothering with drag events (handle, end-scroll).
(cond ((memq part '(above-handle up top))
(calendar-scroll-right nil event))
((memq part '(below-handle down bottom))
(calendar-scroll-left nil event)))))
(defun calendar-scroll-right-three-months (arg &optional event)
"Scroll the displayed calendar window right by 3*ARG months.
......@@ -1648,14 +1648,17 @@ line."
(define-key map [down-mouse-2]
(easy-menu-binding cal-menu-global-mouse-menu))
;; Left-click moves us forward in time, right-click backwards.
;; cf scroll-bar.el.
(define-key map [vertical-scroll-bar mouse-1] 'calendar-scroll-left)
(define-key map [vertical-scroll-bar drag-mouse-1] 'calendar-scroll-left)
;; down-mouse-2 stays as scroll-bar-drag.
(define-key map [vertical-scroll-bar mouse-3] 'calendar-scroll-right)
(define-key map [vertical-scroll-bar drag-mouse-3] 'calendar-scroll-right)
(if (and (boundp 'x-toolkit-scroll-bars) x-toolkit-scroll-bars)
(define-key map [vertical-scroll-bar mouse-1]
;; Left-click moves us forward in time, right-click backwards.
(define-key map [vertical-scroll-bar mouse-1] 'calendar-scroll-left)
(define-key map [vertical-scroll-bar drag-mouse-1] 'calendar-scroll-left)
;; down-mouse-2 stays as scroll-bar-drag.
(define-key map [vertical-scroll-bar mouse-3] 'calendar-scroll-right)
(define-key map [vertical-scroll-bar drag-mouse-3]
"Keymap for `calendar-mode'.")
......@@ -1765,8 +1765,7 @@ variables directly.
Note: This function will erase modifications done by
`font-lock-add-keywords' or `font-lock-remove-keywords', but will
preserve `hi-lock-mode' highlighting patterns."
(let ((hi-lock--inhibit-font-lock-hook t))
(font-lock-mode -1))
(font-lock-mode -1)
(kill-local-variable 'font-lock-set-defaults)
(font-lock-mode 1))
2011-04-05 Teodor Zlatanov <>
* gnus-registry.el (gnus-registry-fixup-registry): New function to
fixup the parameters that can be customized by the user between
save/read cycles.
(gnus-registry-read): Use it.
(gnus-registry-make-db): Use it.
(gnus-registry-spool-action, gnus-registry-handle-action): Fix
(gnus-registry--split-fancy-with-parent-internal): Fix loop. Map
references to actual group names with sender and subject tracking.
(gnus-registry-post-process-groups): Use `cond' for better messaging.
(gnus-registry-usage-test): Add subject lookup test.
* registry.el (registry-db, initialize-instance): Set up constructor
instead of :initform arguments for the sake of older Emacsen.
(registry-lookup-breaks-before-lexbind): New method to demonstrate
pre-lexbind merge bug.
(registry-usage-test): Use it.
(initialize-instance, registry-db): Move the non-function initforms
back to the class definition.
2011-04-03 Teodor Zlatanov <>
* registry.el: New library to manage gnus-registry-style data.
* gnus-registry.el: Use it (major rewrite).
* nnregistry.el: Use it.
* spam.el: Use it.
2011-04-03 Lars Magne Ingebrigtsen <>
* gnus-sum.el (gnus-update-marks): Reinstate the code to not alter
This diff is collapsed.
......@@ -53,7 +53,7 @@
(deffoo nnregistry-request-article (id &optional group server buffer)
(and (not nnregistry-within-nnregistry)
(let* ((nnregistry-within-nnregistry t)
(group (gnus-registry-fetch-group id))
(group (nth 0 (gnus-registry-get-id-key id 'group)))
(gnus-override-method nil))
(message "nnregistry: requesting article `%s' in group `%s'"
id group)
;;; registry.el --- Track and remember data items by various fields
;; Copyright (C) 2011 Free Software Foundation, Inc.
;; Author: Teodor Zlatanov <>
;; Keywords: data
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <>.
;;; Commentary:
;; This library provides a general-purpose EIEIO-based registry
;; database with persistence, initialized with these fields:
;; version: a float, 0.1 currently (don't change it)
;; max-hard: an integer, default 5000000
;; max-soft: an integer, default 50000
;; precious: a list of symbols
;; tracked: a list of symbols
;; tracker: a hashtable tuned for 100 symbols to track (you should
;; only access this with the :lookup2-function and the
;; :lookup2+-function)
;; data: a hashtable with default size 10K and resize threshold 2.0
;; (this reflects the expected usage so override it if you know better)
;; methods to do all the work: `registry-search',
;; `registry-lookup', `registry-lookup-secondary',
;; `registry-lookup-secondary-value', `registry-insert',
;; `registry-delete', `registry-prune', `registry-size' which see
;; and with the following properties:
;; Every piece of data has a unique ID and some general-purpose fields
;; (F1=D1, F2=D2, F3=(a b c)...) expressed as an alist, e.g.
;; ((F1 D1) (F2 D2) (F3 a b c))
;; Note that whether a field has one or many pieces of data, the data
;; is always a list of values.
;; The user decides which fields are "precious", F2 for example. At
;; PRUNE TIME (when the :prune-function is called), the registry will
;; trim any entries without the F2 field until the size is :max-soft
;; or less. No entries with the F2 field will be removed at PRUNE
;; TIME.
;; When an entry is inserted, the registry will reject new entries
;; if they bring it over the max-hard limit, even if they have the F2
;; field.
;; The user decides which fields are "tracked", F1 for example. Any
;; new entry is then indexed by all the tracked fields so it can be
;; quickly looked up that way. The data is always a list (see example
;; above) and each list element is indexed.
;; Precious and tracked field names must be symbols. All other
;; fields can be any other Emacs Lisp types.
;;; Code:
(eval-when-compile (require 'ert))
(eval-when-compile (require 'cl))
(or (ignore-errors (progn
(require 'eieio)
(require 'eieio-base)))
;; gnus-fallback-lib/ from gnus/lisp/gnus-fallback-lib
(let ((load-path (cons (expand-file-name
(file-name-directory (locate-library "gnus")))
(require 'eieio)
(require 'eieio-base)))
"eieio not found in `load-path' or gnus-fallback-lib/ directory.")))
(defclass registry-db (eieio-persistent)
((version :initarg :version
:initform 0.1
:type float
:custom float
:documentation "The registry version.")
(max-hard :initarg :max-hard
:initform 5000000
:type integer
:custom integer
:documentation "Never accept more than this many elements.")
(max-soft :initarg :max-soft
:initform 50000
:type integer
:custom integer
:documentation "Prune as much as possible to get to this size.")
(tracked :initarg :tracked
:initform nil
:type t
:documentation "The tracked (indexed) fields, a list of symbols.")
(precious :initarg :precious
:initform nil
:type t
:documentation "The precious fields, a list of symbols.")
(tracker :initarg :tracker
:type hash-table
:documentation "The field tracking hashtable.")
(data :initarg :data
:type hash-table
:documentation "The data hashtable.")))
(defmethod initialize-instance :after ((this registry-db) slots)
"Set value of data slot of THIS after initialization."
(with-slots (data tracker) this
(unless (member :data slots)
(setq data (make-hash-table :size 10000 :rehash-size 2.0 :test 'equal)))
(unless (member :tracker slots)
(setq tracker (make-hash-table :size 100 :rehash-size 2.0)))))
(defmethod registry-lookup ((db registry-db) keys)
"Search for KEYS in the registry-db THIS.
Returns a alist of the key followed by the entry in a list, not a cons cell."
(let ((data (oref db :data)))
(delq nil
(lambda (k)
(when (gethash k data)
(list k (gethash k data))))
(defmethod registry-lookup-breaks-before-lexbind ((db registry-db) keys)
"Search for KEYS in the registry-db THIS.
Returns a alist of the key followed by the entry in a list, not a cons cell."
(let ((data (oref db :data)))
(delq nil
(loop for key in keys
when (gethash key data)
collect (list key (gethash key data))))))
(defmethod registry-lookup-secondary ((db registry-db) tracksym
&optional create)
"Search for TRACKSYM in the registry-db THIS.
When CREATE is not nil, create the secondary index hashtable if needed."
(let ((h (gethash tracksym (oref db :tracker))))
(if h
(when create
(puthash tracksym
(make-hash-table :size 800 :rehash-size 2.0 :test 'equal)
(oref db :tracker))
(gethash tracksym (oref db :tracker))))))
(defmethod registry-lookup-secondary-value ((db registry-db) tracksym val
&optional set)
"Search for TRACKSYM with value VAL in the registry-db THIS.
When SET is not nil, set it for VAL (use t for an empty list)."
;; either we're asked for creation or there should be an existing index
(when (or set (registry-lookup-secondary db tracksym))
;; set the entry if requested,
(when set
(puthash val (if (eq t set) '() set)
(registry-lookup-secondary db tracksym t)))
(gethash val (registry-lookup-secondary db tracksym))))
(defun registry--match (mode entry check-list)
;; for all members
(when check-list
(let ((key (nth 0 (nth 0 check-list)))
(vals (cdr-safe (nth 0 check-list)))
(while (and key vals (not found))
(setq found (case mode
(member (car-safe vals) (cdr-safe (assoc key entry))))
(string-match (car vals)
(cdr-safe (assoc key entry))
vals (cdr-safe vals)))