diff options
43 files changed, 642 insertions, 445 deletions
diff --git a/ChangeLog b/ChangeLog index b766dbed7dd..a63fbc96bff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-04-12 Glenn Morris <rgm@gnu.org> + + * configure.in: Require ImageMagick >= 6.2.8. (Bug#7955) + 2011-04-09 Paul Eggert <eggert@cs.ucla.edu> * lib/allocator.c: New file, automatically generated by gnulib. diff --git a/autogen/Makefile.in b/autogen/Makefile.in index fc16d7236e6..92e02110712 100644 --- a/autogen/Makefile.in +++ b/autogen/Makefile.in @@ -78,7 +78,8 @@ AR = ar ARFLAGS = cru libgnu_a_AR = $(AR) $(ARFLAGS) am__DEPENDENCIES_1 = -am_libgnu_a_OBJECTS = careadlinkat.$(OBJEXT) dtoastr.$(OBJEXT) +am_libgnu_a_OBJECTS = allocator.$(OBJEXT) careadlinkat.$(OBJEXT) \ + dtoastr.$(OBJEXT) libgnu_a_OBJECTS = $(am_libgnu_a_OBJECTS) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -692,10 +693,10 @@ x_default_search_path = @x_default_search_path@ BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDBOOL_H) \ $(STDDEF_H) $(STDINT_H) stdio.h stdlib.h sys/stat.h time.h \ unistd.h warn-on-use.h -EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \ - allocator.h careadlinkat.h md5.c md5.h dosname.h ftoastr.c \ - ftoastr.h filemode.c filemode.h getloadavg.c getopt.c \ - getopt.in.h getopt1.c getopt_int.h intprops.h lstat.c \ +EXTRA_DIST = allocator.h $(top_srcdir)/./arg-nonnull.h \ + $(top_srcdir)/./c++defs.h careadlinkat.h md5.c md5.h dosname.h \ + ftoastr.c ftoastr.h filemode.c filemode.h getloadavg.c \ + getopt.c getopt.in.h getopt1.c getopt_int.h intprops.h lstat.c \ mktime-internal.h mktime.c readlink.c stat.c stdbool.in.h \ stddef.in.h stdint.in.h stdio.in.h stdlib.in.h strftime.c \ strftime.h symlink.c sys_stat.in.h time.in.h time_r.c \ @@ -708,7 +709,8 @@ MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ time.h-t unistd.h unistd.h-t warn-on-use.h warn-on-use.h-t noinst_LIBRARIES = libgnu.a DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src -libgnu_a_SOURCES = careadlinkat.c dtoastr.c gettext.h ignore-value.h +libgnu_a_SOURCES = allocator.c careadlinkat.c dtoastr.c gettext.h \ + ignore-value.h libgnu_a_LIBADD = $(gl_LIBOBJS) libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) EXTRA_libgnu_a_SOURCES = md5.c ftoastr.c filemode.c getloadavg.c \ @@ -766,6 +768,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/allocator.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/careadlinkat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtoastr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filemode.Po@am__quote@ diff --git a/autogen/configure b/autogen/configure index 563c729f18e..7ec88c66fb5 100755 --- a/autogen/configure +++ b/autogen/configure @@ -6196,6 +6196,7 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } + # Code from module allocator: # Code from module arg-nonnull: # Code from module c++defs: # Code from module careadlinkat: @@ -10008,7 +10009,10 @@ fi HAVE_IMAGEMAGICK=no if test "${HAVE_X11}" = "yes"; then if test "${with_imagemagick}" != "no"; then - IMAGEMAGICK_MODULE="Wand" + ## 6.2.8 is the earliest version known to work, but earlier versions + ## might work - let us know if you find one. + ## 6.0.7 does not work. See bug#7955. + IMAGEMAGICK_MODULE="Wand >= 6.2.8" succeeded=no @@ -15465,6 +15469,7 @@ fi gl_source_base='lib' + # Code from module allocator: # Code from module arg-nonnull: # Code from module c++defs: # Code from module careadlinkat: diff --git a/configure.in b/configure.in index fef19f27642..3d99873eabb 100644 --- a/configure.in +++ b/configure.in @@ -1805,7 +1805,10 @@ fi HAVE_IMAGEMAGICK=no if test "${HAVE_X11}" = "yes"; then if test "${with_imagemagick}" != "no"; then - IMAGEMAGICK_MODULE="Wand" + ## 6.2.8 is the earliest version known to work, but earlier versions + ## might work - let us know if you find one. + ## 6.0.7 does not work. See bug#7955. + IMAGEMAGICK_MODULE="Wand >= 6.2.8" PKG_CHECK_MODULES(IMAGEMAGICK, $IMAGEMAGICK_MODULE, HAVE_IMAGEMAGICK=yes, :) AC_SUBST(IMAGEMAGICK_CFLAGS) AC_SUBST(IMAGEMAGICK_LIBS) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 4daf5b1b9fb..1660ed5335b 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,23 @@ +2011-04-14 Michael Albinus <michael.albinus@gmx.de> + + * tramp.texi (Frequently Asked Questions): New item for disabling + Tramp in other packages. + +2011-04-14 Teodor Zlatanov <tzz@lifelogs.com> + + * gnus.texi (nnmairix caveats, Setup, Registry Article Refer Method) + (Fancy splitting to parent, Store arbitrary data): Updated + gnus-registry docs. + +2011-04-13 Juanma Barranquero <lekktu@gmail.com> + + * ede.texi: Fix typos. + +2011-04-12 Lars Magne Ingebrigtsen <larsi@gnus.org> + + * gnus.texi (Window Layout): @itemize @code doesn't exist. + It's @table @code. + 2011-03-19 Antoine Levitt <antoine.levitt@gmail.com> * gnus.texi (Listing Groups): Document gnus-group-list-ticked diff --git a/doc/misc/ede.texi b/doc/misc/ede.texi index bc097a87150..67df955ca8f 100644 --- a/doc/misc/ede.texi +++ b/doc/misc/ede.texi @@ -2123,7 +2123,7 @@ Results in --add-missing being passed to automake. @end deffn @deffn Method ede-proj-flush-autoconf :AFTER this -Flush the configure file (current buffer) to accomodate @var{THIS}. +Flush the configure file (current buffer) to accommodate @var{THIS}. By flushing, remove any cruft that may be in the file. Subsequent calls to @dfn{ede-proj-tweak-autoconf} can restore items removed by flush. @end deffn @@ -2174,7 +2174,7 @@ These are removed with make clean. @end deffn @deffn Method ede-proj-tweak-autoconf :AFTER this -Tweak the configure file (current buffer) to accomodate @var{THIS}. +Tweak the configure file (current buffer) to accommodate @var{THIS}. @end deffn @deffn Method ede-proj-compilers :AFTER obj @@ -2684,7 +2684,7 @@ Bonus: Return a cons cell: (COMPILED . UPTODATE). @end deffn @deffn Method ede-proj-flush-autoconf :AFTER this -Flush the configure file (current buffer) to accomodate @var{THIS}. +Flush the configure file (current buffer) to accommodate @var{THIS}. @end deffn @deffn Method ede-buffer-mine :AFTER this buffer @@ -2697,7 +2697,7 @@ Return the variable name for @var{THIS}'s sources. @end deffn @deffn Method ede-proj-tweak-autoconf :AFTER this -Tweak the configure file (current buffer) to accomodate @var{THIS}. +Tweak the configure file (current buffer) to accommodate @var{THIS}. @end deffn @deffn Method ede-update-version-in-source :AFTER this version @@ -2777,7 +2777,7 @@ Create or update the autoload target. @end deffn @deffn Method ede-proj-flush-autoconf :AFTER this -Flush the configure file (current buffer) to accomodate @var{THIS}. +Flush the configure file (current buffer) to accommodate @var{THIS}. @end deffn @deffn Method ede-buffer-mine :AFTER this buffer @@ -2796,7 +2796,7 @@ Argument @var{THIS} is the target which needs to insert an info file. @end deffn @deffn Method ede-proj-tweak-autoconf :AFTER this -Tweak the configure file (current buffer) to accomodate @var{THIS}. +Tweak the configure file (current buffer) to accommodate @var{THIS}. @end deffn @deffn Method ede-update-version-in-source :AFTER this version @@ -3008,7 +3008,7 @@ The preferred interpreter for this code. @subsubsection Specialized Methods @deffn Method ede-proj-tweak-autoconf :AFTER this -Tweak the configure file (current buffer) to accomodate @var{THIS}. +Tweak the configure file (current buffer) to accommodate @var{THIS}. @end deffn @@ -3536,7 +3536,7 @@ For example, C code uses .o on unix, and Emacs Lisp uses .elc. @subsubsection Specialized Methods @deffn Method ede-proj-flush-autoconf :AFTER this -Flush the configure file (current buffer) to accomodate @var{THIS}. +Flush the configure file (current buffer) to accommodate @var{THIS}. @end deffn @deffn Method ede-proj-makefile-insert-rules :AFTER this @@ -3558,7 +3558,7 @@ Retrieves the slot @code{sourcetype} from an object of class @code{ede-compilati @end deffn @deffn Method ede-proj-tweak-autoconf :AFTER this -Tweak the configure file (current buffer) to accomodate @var{THIS}. +Tweak the configure file (current buffer) to accommodate @var{THIS}. @end deffn diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 9771392f0cc..9d9b767bcba 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -22061,10 +22061,11 @@ mairix.) @item If you use the Gnus registry: don't use the registry with @code{nnmairix} groups (put them in -@code{gnus-registry-unfollowed-groups}). Be @emph{extra careful} if -you use @code{gnus-registry-split-fancy-with-parent}; mails which are -split into @code{nnmairix} groups are usually gone for good as soon as -you check the group for new mail (yes, it has happened to me...). +@code{gnus-registry-unfollowed-groups}; this is the default). Be +@emph{extra careful} if you use +@code{gnus-registry-split-fancy-with-parent}; mails which are split +into @code{nnmairix} groups are usually gone for good as soon as you +check the group for new mail (yes, it has happened to me...). @item Therefore: @emph{Never ever} put ``real'' mails into @code{nnmairix} @@ -22836,7 +22837,7 @@ windows resized. Here's a list of most of the currently known window configurations, and when they're used: -@itemize @code +@table @code @item group The group buffer. @@ -22903,7 +22904,7 @@ Composing a bounce message. @item mml-preview Previewing a @acronym{MIME} part. -@end itemize +@end table @subsection Example Window Configurations @@ -25916,8 +25917,7 @@ of all messages matching a particular set of criteria. Fortunately, setting up the Gnus registry is pretty easy: @lisp -(setq gnus-registry-max-entries 2500 - gnus-registry-use-long-group-names t) +(setq gnus-registry-max-entries 2500) (gnus-registry-initialize) @end lisp @@ -25939,16 +25939,16 @@ what they do before you copy them blindly). ("spam" t) ("train" t)) gnus-registry-max-entries 500000 - gnus-registry-use-long-group-names t + ;; this is the default gnus-registry-track-extra '(sender subject)) @end lisp -They say: keep a lot of messages around, use long group names, track -messages by sender and subject (not just parent Message-ID), and when -the registry splits incoming mail, use a majority rule to decide where -messages should go if there's more than one possibility. In addition, -the registry should ignore messages in groups that match ``nntp'', -``nnrss'', ``spam'', or ``train.'' +They say: keep a lot of messages around, track messages by sender and +subject (not just parent Message-ID), and when the registry splits +incoming mail, use a majority rule to decide where messages should go +if there's more than one possibility. In addition, the registry +should ignore messages in groups that match ``nntp'', ``nnrss'', +``spam'', or ``train.'' You are doubtless impressed by all this, but you ask: ``I am a Gnus user, I customize to live. Give me more.'' Here you go, these are @@ -25958,19 +25958,9 @@ the general settings. The groups that will not be followed by @code{gnus-registry-split-fancy-with-parent}. They will still be remembered by the registry. This is a list of regular expressions. -@end defvar - -@defvar gnus-registry-ignored-groups -The groups that will not be remembered by the registry. This is a -list of regular expressions, also available through Group/Topic -customization (so you can ignore or keep a specific group or a whole -topic). -@end defvar - -@defvar gnus-registry-use-long-group-names -Whether the registry will use long group names. It's recommended to -set this to @code{t}, although everything works if you don't. Future -functionality will require it. +By default any group name that ends with ``delayed'', ``drafts'', +``queue'', or ``INBOX'', belongs to the nnmairix backend, or contains +the word ``archive'' is not followed. @end defvar @defvar gnus-registry-max-entries @@ -25978,8 +25968,15 @@ The number (an integer or @code{nil} for unlimited) of entries the registry will keep. @end defvar +@defvar gnus-registry-max-pruned-entries +The maximum number (an integer or @code{nil} for unlimited) of entries +the registry will keep after pruning. +@end defvar + @defvar gnus-registry-cache-file -The file where the registry will be stored between Gnus sessions. +The file where the registry will be stored between Gnus sessions. By +default the file name is @code{.gnus.registry.eioio} in the same +directory as your @code{.newsrc.eld}. @end defvar @node Registry Article Refer Method @@ -26003,8 +26000,7 @@ lines: ;; Keep enough entries to have a good hit rate when referring to an ;; article using the registry. Use long group names so that Gnus ;; knows where the article is. -(setq gnus-registry-max-entries 2500 - gnus-registry-use-long-group-names t) +(setq gnus-registry-max-entries 2500) (gnus-registry-initialize) @@ -26050,9 +26046,8 @@ following variables. @defvar gnus-registry-track-extra This is a list of symbols, so it's best to change it from the -Customize interface. By default it's @code{nil}, but you may want to -track @code{subject} and @code{sender} as well when splitting by parent. -It may work for you. It can be annoying if your mail flow is large and +Customize interface. By default it's @code{(subject sender)}, which +may work for you. It can be annoying if your mail flow is large and people don't stick to the same groups. @end defvar @@ -26060,7 +26055,8 @@ people don't stick to the same groups. This is a symbol, so it's best to change it from the Customize interface. By default it's @code{nil}, but you may want to set it to @code{majority} or @code{first} to split by sender or subject based on -the majority of matches or on the first found. +the majority of matches or on the first found. I find @code{majority} +works best. @end defvar @node Store custom flags and keywords @@ -26095,17 +26091,12 @@ The registry has a simple API that uses a Message-ID as the key to store arbitrary data (as long as it can be converted to a list for storage). -@defun gnus-registry-store-extra-entry (id key value) -Store @code{value} in the extra data key @code{key} for message -@code{id}. -@end defun - -@defun gnus-registry-delete-extra-entry (id key) -Delete the extra data key @code{key} for message @code{id}. +@defun gnus-registry-set-id-key (id key value) +Store @code{value} under @code{key} for message @code{id}. @end defun -@defun gnus-registry-fetch-extra (id key) -Get the extra data key @code{key} for message @code{id}. +@defun gnus-registry-get-id-key (id key) +Get the data under @code{key} for message @code{id}. @end defun @defvar gnus-registry-extra-entries-precious diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index e1c4a806de2..2663d2df0f5 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -2812,7 +2812,6 @@ When @value{tramp} does not connect to the remote host, there are three reasons heading the bug mailing list: @itemize @minus - @item Unknown characters in the prompt @@ -2882,7 +2881,6 @@ checksum. (when (file-remote-p default-directory) (set (make-local-variable 'file-precious-flag) t)))) @end lisp - @end itemize @@ -3377,14 +3375,43 @@ export EDITOR=/path/to/emacsclient.sh @item -How can I disable @value{tramp}? +There are packages which call @value{tramp} although I haven't entered +a remote file name ever. I dislike it, how could I disable it? -Shame on you, why did you read until now? +In general, @value{tramp} functions are used only when +you apply remote file name syntax. However, some packages enable +@value{tramp} on their own. @itemize @minus +@item +@file{ido.el} + +You could disable @value{tramp} file name completion: + +@lisp +(custom-set-variables + '(ido-enable-tramp-completion nil)) +@end lisp @item +@file{rlogin.el} + +You could disable remote directory tracking mode: + +@lisp +(rlogin-directory-tracking-mode -1) +@end lisp +@end itemize + + +@item +How can I disable @value{tramp} at all? + +Shame on you, why did you read until now? + +@itemize @minus @ifset emacs +@item If you just want to have @value{ftppackagename} as default remote files access package, you should apply the following code: @@ -131,8 +131,10 @@ for this. ** ImageMagick support. It is now possible to use the ImageMagick library to load many new image formats in Emacs. By default, Emacs links with the ImageMagick -libraries if they are present at build time. To disable this, use -the configure option `--without-imagemagick'. +libraries if they are present at build time. This needs ImageMagick +6.2.8 or newer (versions newer than 6.0.7 _may_ work but have not been +tested). To disable ImageMagick support, use the configure option +`--without-imagemagick'. The new function `imagemagick-types' returns a list of image file extensions that your installation of ImageMagick supports. The diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 51f8066077d..bde1f1174c9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,7 +1,80 @@ +2011-04-14 Michael Albinus <michael.albinus@gmx.de> + + * net/tramp-sh.el (tramp-sh-handle-file-attributes): Handle the + case when the scripts fail. Use `tramp-do-file-attributes-with-ls' + then. + (tramp-do-copy-or-rename-file-out-of-band): Do not check any + longer, whether`executable-find' is bound. + + * net/tramp-smb.el (tramp-smb-handle-copy-file): Fix docstring. + +2011-04-14 Stefan Monnier <monnier@iro.umontreal.ca> + + * minibuffer.el (completion-in-region-mode-predicate) + (completion-in-region-mode--predicate): New vars. + (completion-in-region, completion-in-region--postch) + (completion-in-region-mode): Use them. + (completion--capf-wrapper): Also return the hook function. + (completion-at-point, completion-help-at-point): + Adjust and provide a predicate. + + Preserve arg names for advice of subr and lexical functions (bug#8457). + * help-fns.el (help-function-arglist): Consolidate the subr and + new-byte-code cases. Add argument `preserve-names' to extract names + from the docstring when needed. + * emacs-lisp/advice.el (ad-define-subr-args, ad-undefine-subr-args) + (ad-subr-args-defined-p, ad-get-subr-args, ad-subr-arglist): Remove. + (ad-arglist): Use help-function-arglist's new arg. + (ad-definition-type): Use cond. + +2011-04-13 Juanma Barranquero <lekktu@gmail.com> + + * autorevert.el (auto-revert-handler): + Bind `remote-file-name-inhibit-cache', not `tramp-cache-inhibit-cache', + which was removed in 2010-10-02T13:21:43Z!michael.albinus@gmx.de. + Don't quote lambda. + + * image-mode.el (image-transform-set-scale): + Fix change in 2011-04-09T20:28:01Z!cyd@stupidchicken.com. + +2011-04-12 Lars Magne Ingebrigtsen <larsi@gnus.org> + + * net/network-stream.el (network-stream-open-starttls): Only do + opportunistic STARTTLS upgrades if we have built-in gnutls support. + Upgrades via gnutls-cli are too slow to be done opportunistically. + +2011-04-12 Juanma Barranquero <lekktu@gmail.com> + + * dframe.el (dframe-current-frame): Remove spurious quote. + +2011-04-12 Glenn Morris <rgm@gnu.org> + + * calendar/cal-tex.el (cal-tex-end-document): + Try to automatically use latin1 input if needed. + + * calendar/cal-hebrew.el (diary-hebrew-rosh-hodesh): + Don't try to cons a mark onto an empty element. + +2011-04-11 Leo Liu <sdl.web@gmail.com> + + * ido.el (ido-buffer-internal): Allow method 'kill for virtual + buffers. + (ido-kill-buffer-at-head): Support killing virtual buffers. + +2011-04-10 Chong Yidong <cyd@stupidchicken.com> + + * minibuffer.el (completion-show-inline-help): New var. + (completion--do-completion, minibuffer-complete) + (minibuffer-force-complete, minibuffer-complete-word): Inhibit + minibuffer messages if completion-show-inline-help is nil. + + * icomplete.el (icomplete-mode): Bind completion-show-inline-help + to avoid interference from inline help (Bug#5849). + 2011-04-10 Leo Liu <sdl.web@gmail.com> - * emacs-lisp/tabulated-list.el (tabulated-list-print-entry): Fix - typo. + * emacs-lisp/tabulated-list.el (tabulated-list-print-entry): + Fix typo. 2011-04-09 Chong Yidong <cyd@stupidchicken.com> @@ -14,14 +87,14 @@ (image-transform-fit-to-width): Handle image-toggle-display-image and image-transform-resize directly. -2011-04-08 Sho Nakatani <lay.sakura@gmail.com> +2011-04-08 Sho Nakatani <lay.sakura@gmail.com> * doc-view.el (doc-view-fit-width-to-window) - (doc-view-fit-height-to-window, doc-view-fit-page-to-window): New - functions for fitting the shown image to the Emacs window size. + (doc-view-fit-height-to-window, doc-view-fit-page-to-window): + New functions for fitting the shown image to the Emacs window size. (doc-view-mode-map): Add bindings for the new functions. -2011-03-24 Juanma Barranquero <lekktu@gmail.com> +2011-04-08 Juanma Barranquero <lekktu@gmail.com> * vc-annotate.el (vc-annotate-show-log-revision-at-line): Fix typo in docstring. @@ -101,12 +174,12 @@ (package-menu-refresh, list-packages): Use it. (package-menu--print-info): Renamed from package-print-package. Return insertion data instead of inserting it directly. - (package-menu-describe-package, package-menu-execute): Use - tabulated-list-get-id. + (package-menu-describe-package, package-menu-execute): + Use tabulated-list-get-id. (package-menu-mark-delete, package-menu-mark-install) (package-menu-mark-unmark, package-menu-backup-unmark) - (package-menu-mark-obsolete-for-deletion): Use - tabulated-list-put-tag. + (package-menu-mark-obsolete-for-deletion): + Use tabulated-list-put-tag. (package--list-packages, package-menu-revert) (package-menu-get-package, package-menu-get-version) (package-menu-sort-by-column): Functions deleted. @@ -223,11 +296,11 @@ 2011-04-02 Chong Yidong <cyd@stupidchicken.com> - * emacs-lisp/package.el (package--with-work-buffer): Recognize - https URLs. + * emacs-lisp/package.el (package--with-work-buffer): + Recognize https URLs. - * net/network-stream.el: Move from gnus/proto-stream.el. Change - prefix to network-stream throughout. + * net/network-stream.el: Move from gnus/proto-stream.el. + Change prefix to network-stream throughout. (open-protocol-stream): Merge into open-network-stream, leaving open-protocol-stream as an alias. Handle nil BUFFER args. @@ -905,10 +978,10 @@ 2011-03-11 Ken Manheimer <ken.manheimer@gmail.com> - * allout-widgets.el (allout-widgets-tally): Initialize - allout-widgets-tally as a hash table rather than nil to prevent - mode-line redisplay warnings. - Also, clarify the module description and fix a comment typo. + * allout-widgets.el (allout-widgets-tally): + Initialize allout-widgets-tally as a hash table rather than nil to + prevent mode-line redisplay warnings. Also, clarify the module + description and fix a comment typo. 2011-03-11 Juanma Barranquero <lekktu@gmail.com> diff --git a/lisp/autorevert.el b/lisp/autorevert.el index 2bc7310d7e5..c67b6663bd0 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el @@ -434,9 +434,9 @@ This is an internal function used by Auto-Revert Mode." (file-readable-p buffer-file-name) (if auto-revert-tail-mode ;; Tramp caches the file attributes. Setting - ;; `tramp-cache-inhibit' forces Tramp to - ;; reread the values. - (let ((tramp-cache-inhibit-cache t)) + ;; `remote-file-name-inhibit-cache' forces Tramp + ;; to reread the values. + (let ((remote-file-name-inhibit-cache t)) (/= auto-revert-tail-pos (setq size (nth 7 (file-attributes @@ -460,10 +460,10 @@ This is an internal function used by Auto-Revert Mode." (when buffer-file-name (setq eob (eobp)) (walk-windows - #'(lambda (window) - (and (eq (window-buffer window) buffer) - (= (window-point window) (point-max)) - (push window eoblist))) + (lambda (window) + (and (eq (window-buffer window) buffer) + (= (window-point window) (point-max)) + (push window eoblist))) 'no-mini t)) (if auto-revert-tail-mode (auto-revert-tail-handler size) diff --git a/lisp/calendar/cal-hebrew.el b/lisp/calendar/cal-hebrew.el index e5373a28756..44c3e62a7c2 100644 --- a/lisp/calendar/cal-hebrew.el +++ b/lisp/calendar/cal-hebrew.el @@ -954,16 +954,17 @@ use when highlighting the day in the calendar." (format "%s (second day)" this-month) this-month)))) (if (= (% d 7) 6) ; Saturday--check for Shabbat Mevarchim - (cons mark - (cond ((and (> h-day 22) (/= h-month 6) (= 29 last-day)) + (cond ((and (> h-day 22) (/= h-month 6) (= 29 last-day)) + (cons mark (format "Mevarchim Rosh Hodesh %s (%s)" (aref h-month-names (if (= h-month (calendar-hebrew-last-month-of-year h-year)) 0 h-month)) - (aref calendar-day-name-array (- 29 h-day)))) - ((and (< h-day 30) (> h-day 22) (= 30 last-day)) + (aref calendar-day-name-array (- 29 h-day))))) + ((and (< h-day 30) (> h-day 22) (= 30 last-day)) + (cons mark (format "Mevarchim Rosh Hodesh %s (%s-%s)" (aref h-month-names h-month) (if (= h-day 29) diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el index a3f71107854..2fc215c06c4 100644 --- a/lisp/calendar/cal-tex.el +++ b/lisp/calendar/cal-tex.el @@ -1587,6 +1587,16 @@ FINAL-SEPARATOR is non-nil." Insert the trailer to LaTeX document, pop to LaTeX buffer, add informative header, and run HOOK." (cal-tex-e-document) + (or (and cal-tex-preamble-extra + (string-match "inputenc" cal-tex-preamble-extra)) + (not (re-search-backward "[^[:ascii:]]" nil 'move)) + (progn + (goto-char (point-min)) + (when (search-forward "documentclass" nil t) + (forward-line 1) + ;; Eg for some Bahai holidays. + ;; FIXME latin1 might not always be right. + (insert "\\usepackage[latin1]{inputenc}\n")))) (latex-mode) (pop-to-buffer cal-tex-buffer) (goto-char (point-min)) diff --git a/lisp/dframe.el b/lisp/dframe.el index 312f49f6053..71773b1abf8 100644 --- a/lisp/dframe.el +++ b/lisp/dframe.el @@ -632,7 +632,7 @@ selecting FRAME-VAR." FRAME-VAR is the variable storing the currently active dedicated frame. If the current frame's buffer uses DESIRED-MAJOR-MODE, then use that frame." (if (not (eq (selected-frame) (symbol-value frame-var))) - (if (and (eq major-mode 'desired-major-mode) + (if (and (eq major-mode desired-major-mode) (get-buffer-window (current-buffer)) (window-frame (get-buffer-window (current-buffer)))) (window-frame (get-buffer-window (current-buffer))) diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el index 39ea97aa98e..5934975e36a 100644 --- a/lisp/emacs-lisp/advice.el +++ b/lisp/emacs-lisp/advice.el @@ -503,36 +503,6 @@ ;; exact structure of the original argument list as long as the new argument ;; list takes a compatible number/magnitude of actual arguments. -;; @@@ Definition of subr argument lists: -;; ====================================== -;; When advice constructs the advised definition of a function it has to -;; know the argument list of the original function. For functions and macros -;; the argument list can be determined from the actual definition, however, -;; for subrs there is no such direct access available. In Lemacs and for some -;; subrs in Emacs-19 the argument list of a subr can be determined from -;; its documentation string, in a v18 Emacs even that is not possible. If -;; advice cannot at all determine the argument list of a subr it uses -;; `(&rest ad-subr-args)' which will always work but is inefficient because -;; it conses up arguments. The macro `ad-define-subr-args' can be used by -;; the advice programmer to explicitly tell advice about the argument list -;; of a certain subr, for example, -;; -;; (ad-define-subr-args 'fset '(sym newdef)) -;; -;; is used by advice itself to tell a v18 Emacs about the arguments of `fset'. -;; The following can be used to undo such a definition: -;; -;; (ad-undefine-subr-args 'fset) -;; -;; The argument list definition is stored on the property list of the subr -;; name symbol. When an argument list could be determined from the -;; documentation string it will be cached under that property. The general -;; mechanism for looking up the argument list of a subr is the following: -;; 1) look for a definition stored on the property list -;; 2) if that failed try to infer it from the documentation string and -;; if successful cache it on the property list -;; 3) otherwise use `(&rest ad-subr-args)' - ;; @@ Activation and deactivation: ;; =============================== ;; The definition of an advised function does not change until all its advice @@ -1654,41 +1624,6 @@ ;; (fii 3 2) ;; 5 ;; -;; @@ Specifying argument lists of subrs: -;; ====================================== -;; The argument lists of subrs cannot be determined directly from Lisp. -;; This means that Advice has to use `(&rest ad-subr-args)' as the -;; argument list of the advised subr which is not very efficient. In Lemacs -;; subr argument lists can be determined from their documentation string, in -;; Emacs-19 this is the case for some but not all subrs. To accommodate -;; for the cases where the argument lists cannot be determined (e.g., in a -;; v18 Emacs) Advice comes with a specification mechanism that allows the -;; advice programmer to tell advice what the argument list of a certain subr -;; really is. -;; -;; In a v18 Emacs the following will return the &rest idiom: -;; -;; (ad-arglist (symbol-function 'car)) -;; (&rest ad-subr-args) -;; -;; To tell advice what the argument list of `car' really is we -;; can do the following: -;; -;; (ad-define-subr-args 'car '(list)) -;; ((list)) -;; -;; Now `ad-arglist' will return the proper argument list (this method is -;; actually used by advice itself for the advised definition of `fset'): -;; -;; (ad-arglist (symbol-function 'car)) -;; (list) -;; -;; The defined argument list will be stored on the property list of the -;; subr name symbol. When advice looks for a subr argument list it first -;; checks for a definition on the property list, if that fails it tries -;; to infer it from the documentation string and caches it on the property -;; list if it was successful, otherwise `(&rest ad-subr-args)' will be used. -;; ;; @@ Advising interactive subrs: ;; ============================== ;; For the most part there is no difference between advising functions and @@ -2536,52 +2471,11 @@ See Info node `(elisp)Computed Advice' for detailed documentation." If DEFINITION could be from a subr then its NAME should be supplied to make subr arglist lookup more efficient." (require 'help-fns) - (cond - ((or (ad-macro-p definition) (ad-advice-p definition)) - (help-function-arglist (cdr definition))) - (t (help-function-arglist definition)))) - -;; Store subr-args as `((arg1 arg2 ...))' so I can distinguish -;; a defined empty arglist `(nil)' from an undefined arglist: -(defmacro ad-define-subr-args (subr arglist) - `(put ,subr 'ad-subr-arglist (list ,arglist))) -(defmacro ad-undefine-subr-args (subr) - `(put ,subr 'ad-subr-arglist nil)) -(defmacro ad-subr-args-defined-p (subr) - `(get ,subr 'ad-subr-arglist)) -(defmacro ad-get-subr-args (subr) - `(car (get ,subr 'ad-subr-arglist))) - -(defun ad-subr-arglist (subr-name) - "Retrieve arglist of the subr with SUBR-NAME. -Either use the one stored under the `ad-subr-arglist' property, -or try to retrieve it from the docstring and cache it under -that property, or otherwise use `(&rest ad-subr-args)'." - (if (ad-subr-args-defined-p subr-name) - (ad-get-subr-args subr-name) - ;; says jwz: Should use this for Lemacs 19.8 and above: - ;;((fboundp 'subr-min-args) - ;; ...) - ;; says hans: I guess what Jamie means is that I should use the values - ;; of `subr-min-args' and `subr-max-args' to construct the subr arglist - ;; without having to look it up via parsing the docstring, e.g., - ;; values 1 and 2 would suggest `(arg1 &optional arg2)' as an - ;; argument list. However, that won't work because there is no - ;; way to distinguish a subr with args `(a &optional b &rest c)' from - ;; one with args `(a &rest c)' using that mechanism. Also, the argument - ;; names from the docstring are more meaningful. Hence, I'll stick with - ;; the old way of doing things. - (let ((doc (or (ad-real-documentation subr-name t) ""))) - (if (not (string-match "\n\n\\((.+)\\)\\'" doc)) - ;; Signalling an error leads to bugs during bootstrapping because - ;; the DOC file is not yet built (which is an error, BTW). - ;; (error "The usage info is missing from the subr %s" subr-name) - '(&rest ad-subr-args) - (ad-define-subr-args - subr-name - (cdr (car (read-from-string - (downcase (match-string 1 doc)))))) - (ad-get-subr-args subr-name))))) + (help-function-arglist + (if (or (ad-macro-p definition) (ad-advice-p definition)) + (cdr definition) + definition) + 'preserve-names)) (defun ad-docstring (definition) "Return the unexpanded docstring of DEFINITION." @@ -2629,17 +2523,16 @@ definition (see the code for `documentation')." (defun ad-definition-type (definition) "Return symbol that describes the type of DEFINITION." - (if (ad-macro-p definition) - 'macro - (if (ad-subr-p definition) - (if (ad-special-form-p definition) - 'special-form - 'subr) - (if (or (ad-lambda-p definition) - (ad-compiled-p definition)) - 'function - (if (ad-advice-p definition) - 'advice))))) + (cond + ((ad-macro-p definition) 'macro) + ((ad-subr-p definition) + (if (ad-special-form-p definition) + 'special-form + 'subr)) + ((or (ad-lambda-p definition) + (ad-compiled-p definition)) + 'function) + ((ad-advice-p definition) 'advice))) (defun ad-has-proper-definition (function) "True if FUNCTION is a symbol with a proper definition. @@ -3921,10 +3814,6 @@ undone on exit of this macro." ;; Use the advice mechanism to advise `documentation' to make it ;; generate proper documentation strings for advised definitions: -;; This makes sure we get the right arglist for `documentation' -;; during bootstrapping. -(ad-define-subr-args 'documentation '(function &optional raw)) - ;; @@ Starting, stopping and recovering from the advice package magic: ;; =================================================================== diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index baabe5f65b9..cc5156610be 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,52 @@ +2011-04-14 Teodor Zlatanov <tzz@lifelogs.com> + + * gnus-registry.el: Updated gnus-registry docs. + +2011-04-12 Teodor Zlatanov <tzz@lifelogs.com> + + * gnus-registry.el (gnus-registry--split-fancy-with-parent-internal): + Fix logic bug. + (gnus-registry-post-process-groups): Fix logging of no results and + quote sender and subject. + +2011-04-12 Lars Magne Ingebrigtsen <larsi@gnus.org> + + * gnus-start.el (gnus-get-unread-articles): Slight cleanup. + (gnus-read-active-for-groups): Don't try to finish getting stuff where + we had no early-data returned. + (gnus-get-unread-articles): Add a sanity check so that we don't issue + two async commands to the same server at the same time. + +2011-04-12 Stig Sandbeck Mathisen <ssm@fnord.no> (tiny change) + + * gnus-sum.el (gnus-summary-select-article-buffer): Doc fix. + +2011-04-12 Lars Magne Ingebrigtsen <larsi@gnus.org> + + * gnus-registry.el (gnus-registry-remake-db): Put the warning on a + "warning" level. + + * mm-url.el (mm-url-package-name): Removed to ease third-party reuse. + (mm-url-insert-file-contents): Don't set the package names. + +2011-04-11 Teodor Zlatanov <tzz@lifelogs.com> + + * gnus-registry.el (gnus-registry-action): Remove properties and + simplify subject in `gnus-registry-handle-action'. + (gnus-registry-spool-action): Get subject and sender from message if + they are not passed in. + (gnus-registry-handle-action): Remove properties and simplify subject + consistently. + +2011-04-11 Stefan Monnier <monnier@iro.umontreal.ca> + + * registry.el: Require CL before using defmacro*. + +2011-04-11 Katsumi Yamaoka <yamaoka@jpl.org> + + * gnus-art.el (article-treat-date): Assume that + gnus-article-date-headers may be a group parameter. + 2011-04-07 Teodor Zlatanov <tzz@lifelogs.com> * gnus-registry.el (gnus-registry-handle-action): More debugging. diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 97677988f0a..e03c787d995 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -3407,7 +3407,11 @@ lines forward." (setq ended t))))) (defun article-treat-date () - (article-date-ut gnus-article-date-headers t)) + (article-date-ut (if (gnus-buffer-live-p gnus-summary-buffer) + (with-current-buffer gnus-summary-buffer + gnus-article-date-headers) + gnus-article-date-headers) + t)) (defun article-date-ut (&optional type highlight date-position) "Convert DATE date to TYPE in the current article. diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el index 9824fc26f16..9f95ce756ab 100644 --- a/lisp/gnus/gnus-registry.el +++ b/lisp/gnus/gnus-registry.el @@ -33,9 +33,10 @@ ;; you, submit a bug report and I'll be glad to fix it. It needs ;; documentation in the manual (also on my to-do list). -;; Put this in your startup file (~/.gnus.el for instance) +;; Put this in your startup file (~/.gnus.el for instance) or use Customize: -;; (setq gnus-registry-max-entries 2500) +;; (setq gnus-registry-max-entries 2500 +;; gnus-registry-track-extra '(sender subject)) ;; (gnus-registry-initialize) @@ -258,7 +259,7 @@ the Bit Bucket." This is not required after changing `gnus-registry-cache-file'." (interactive (list (y-or-n-p "Remake and CLEAR the Gnus registry? "))) (when forsure - (gnus-message 1 "Remaking the Gnus registry") + (gnus-message 4 "Remaking the Gnus registry") (setq gnus-registry-db (gnus-registry-make-db)))) (defun gnus-registry-read () @@ -294,11 +295,8 @@ This is not required after changing `gnus-registry-cache-file'." ;; article move/copy/spool/delete actions (defun gnus-registry-action (action data-header from &optional to method) (let* ((id (mail-header-id data-header)) - (subject (gnus-string-remove-all-properties - (gnus-registry-simplify-subject - (mail-header-subject data-header)))) - (sender (gnus-string-remove-all-properties - (mail-header-from data-header))) + (subject (mail-header-subject data-header)) + (sender (mail-header-from data-header)) (from (gnus-group-guess-full-name-from-command-method from)) (to (if to (gnus-group-guess-full-name-from-command-method to) nil)) (to-name (if to to "the Bit Bucket"))) @@ -312,7 +310,9 @@ This is not required after changing `gnus-registry-cache-file'." to subject sender))) (defun gnus-registry-spool-action (id group &optional subject sender) - (let ((to (gnus-group-guess-full-name-from-command-method group))) + (let ((to (gnus-group-guess-full-name-from-command-method group)) + (subject (or subject (message-fetch-field "subject"))) + (sender (or sender (message-fetch-field "from")))) (when (and (stringp id) (string-match "\r$" id)) (setq id (substring id 0 -1))) (gnus-message 7 "Gnus registry: article %s spooled to %s" @@ -326,7 +326,10 @@ This is not required after changing `gnus-registry-cache-file'." "gnus-registry-handle-action %S" (list id from to subject sender)) (let ((db gnus-registry-db) ;; safe if not found - (entry (gnus-registry-get-or-make-entry id))) + (entry (gnus-registry-get-or-make-entry id)) + (subject (gnus-string-remove-all-properties + (gnus-registry-simplify-subject subject))) + (sender (gnus-string-remove-all-properties sender))) ;; this could be done by calling `gnus-registry-set-id-key' ;; several times but it's better to bunch the transactions @@ -426,9 +429,9 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." (when (and (null found) (memq 'sender gnus-registry-track-extra) sender - (gnus-grep-in-list - sender - gnus-registry-unfollowed-addresses)) + (not (gnus-grep-in-list + sender + gnus-registry-unfollowed-addresses))) (let ((groups (apply 'append (mapcar @@ -562,12 +565,12 @@ possible. Uses `gnus-registry-split-strategy'." ((null out) (gnus-message 5 - "%s: no matches for %s %s." - log-agent out mode key) + "%s: no matches for %s '%s'." + log-agent mode key) nil) (t (gnus-message 5 - "%s: too many extra matches (%s) for %s %s. Returning none." + "%s: too many extra matches (%s) for %s '%s'. Returning none." log-agent out mode key) nil)))) diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index d9d218c6cba..e3b0089cea9 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el @@ -1699,33 +1699,43 @@ If SCAN, request a scan of that group as well." (gnus-read-active-file-1 method nil)))) ;; Start early async retrieval of data. - (dolist (elem type-cache) - (destructuring-bind (method method-type infos dummy) elem - (when (and method infos - (not (gnus-method-denied-p method))) - ;; If the open-server method doesn't exist, then the method - ;; itself doesn't exist, so we ignore it. - (if (not (ignore-errors (gnus-get-function method 'open-server))) - (setq type-cache (delq elem type-cache)) - (unless (gnus-server-opened method) - (gnus-open-server method)) - (when (and - (gnus-server-opened method) - (gnus-check-backend-function - 'retrieve-group-data-early (car method))) - (when (gnus-check-backend-function 'request-scan (car method)) - (gnus-request-scan nil method)) - ;; Store the token we get back from -early so that we - ;; can pass it to -finish later. - (setcar (nthcdr 3 elem) - (gnus-retrieve-group-data-early method infos))))))) + (let ((done-methods nil) + sanity-spec) + (dolist (elem type-cache) + (destructuring-bind (method method-type infos dummy) elem + (setq sanity-spec (list (car method) (cadr method))) + (when (and method infos + (not (gnus-method-denied-p method))) + ;; If the open-server method doesn't exist, then the method + ;; itself doesn't exist, so we ignore it. + (if (not (ignore-errors (gnus-get-function method 'open-server))) + (setq type-cache (delq elem type-cache)) + (unless (gnus-server-opened method) + (gnus-open-server method)) + (when (and + ;; This is a sanity check, so that we never + ;; attempt to start two async requests to the + ;; same server, because that will fail. This + ;; should never happen, since the methods should + ;; be unique at this point, but apparently it + ;; does happen in the wild with some setups. + (not (member sanity-spec done-methods)) + (gnus-server-opened method) + (gnus-check-backend-function + 'retrieve-group-data-early (car method))) + (push sanity-spec done-methods) + (when (gnus-check-backend-function 'request-scan (car method)) + (gnus-request-scan nil method)) + ;; Store the token we get back from -early so that we + ;; can pass it to -finish later. + (setcar (nthcdr 3 elem) + (gnus-retrieve-group-data-early method infos)))))))) ;; Do the rest of the retrieval. (dolist (elem type-cache) (destructuring-bind (method method-type infos early-data) elem (when (and method infos - (not (eq (gnus-server-status method) - 'denied))) + (not (gnus-method-denied-p method))) (let ((updatep (gnus-check-backend-function 'request-update-info (car method)))) ;; See if any of the groups from this method require updating. @@ -1763,6 +1773,7 @@ If SCAN, request a scan of that group as well." ;; Finish up getting the data from the methods that have -early ;; methods. ((and + early-data (gnus-check-backend-function 'finish-retrieve-group-infos (car method)) (or (not (gnus-agent-method-p method)) (gnus-online method))) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index e3ae1d7f528..d023bc5bb63 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -7035,7 +7035,7 @@ displayed, no centering will be performed." (defun gnus-summary-select-article-buffer () "Reconfigure windows to show the article buffer. -If `gnus-widen-article-buffer' is set, show only the article +If `gnus-widen-article-window' is set, show only the article buffer." (interactive) (if (not (gnus-buffer-live-p gnus-article-buffer)) diff --git a/lisp/gnus/mm-url.el b/lisp/gnus/mm-url.el index 498d0612519..2ce3791ef3d 100644 --- a/lisp/gnus/mm-url.el +++ b/lisp/gnus/mm-url.el @@ -83,13 +83,6 @@ Likely values are `wget', `w3m', `lynx' and `curl'." ;;; Internal variables -(defvar mm-url-package-name - (gnus-replace-in-string - (gnus-replace-in-string gnus-version " v.*$" "") - " " "-")) - -(defvar mm-url-package-version gnus-version-number) - ;; Stolen from w3. (defvar mm-url-html-entities '( @@ -298,10 +291,6 @@ If `mm-url-use-external' is non-nil, use `mm-url-program'." (if (not (and (boundp 'url-version) (equal url-version "Emacs"))) (list (cons "Connection" "Close")))) - (url-package-name (or mm-url-package-name - url-package-name)) - (url-package-version (or mm-url-package-version - url-package-version)) result) (setq result (url-insert-file-contents url)) (save-excursion diff --git a/lisp/gnus/registry.el b/lisp/gnus/registry.el index 3c402cb361a..23e75815979 100644 --- a/lisp/gnus/registry.el +++ b/lisp/gnus/registry.el @@ -77,14 +77,14 @@ ;;; Code: +(eval-when-compile (require 'cl)) + (eval-when-compile (when (null (ignore-errors (require 'ert))) (defmacro* ert-deftest (name () &body docstring-keys-and-body)))) (ignore-errors (require 'ert)) - -(eval-when-compile (require 'cl)) (eval-and-compile (or (ignore-errors (progn (require 'eieio) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 206a9af3a90..97ce7ca44ef 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -99,46 +99,55 @@ ARGLIST can also be t or a string of the form \"(FUN ARG1 ARG2 ...)\"." (format "%S" (help-make-usage 'fn arglist)))))) ;; FIXME: Move to subr.el? -(defun help-function-arglist (def) +(defun help-function-arglist (def &optional preserve-names) + "Return a formal argument list for the function DEF. +IF PRESERVE-NAMES is non-nil, return a formal arglist that uses +the same names as used in the original source code, when possible." ;; Handle symbols aliased to other symbols. (if (and (symbolp def) (fboundp def)) (setq def (indirect-function def))) ;; If definition is a macro, find the function inside it. (if (eq (car-safe def) 'macro) (setq def (cdr def))) (cond - ((and (byte-code-function-p def) (integerp (aref def 0))) - (let* ((args-desc (aref def 0)) - (max (lsh args-desc -8)) - (min (logand args-desc 127)) - (rest (logand args-desc 128)) - (arglist ())) - (dotimes (i min) - (push (intern (concat "arg" (number-to-string (1+ i)))) arglist)) - (when (> max min) - (push '&optional arglist) - (dotimes (i (- max min)) - (push (intern (concat "arg" (number-to-string (+ 1 i min)))) - arglist))) - (unless (zerop rest) (push '&rest arglist) (push 'rest arglist)) - (nreverse arglist))) - ((byte-code-function-p def) (aref def 0)) + ((and (byte-code-function-p def) (listp (aref def 0))) (aref def 0)) ((eq (car-safe def) 'lambda) (nth 1 def)) ((eq (car-safe def) 'closure) (nth 2 def)) - ((subrp def) - (let ((arity (subr-arity def)) - (arglist ())) - (dotimes (i (car arity)) - (push (intern (concat "arg" (number-to-string (1+ i)))) arglist)) - (cond - ((not (numberp (cdr arglist))) - (push '&rest arglist) - (push 'rest arglist)) - ((< (car arity) (cdr arity)) - (push '&optional arglist) - (dotimes (i (- (cdr arity) (car arity))) - (push (intern (concat "arg" (number-to-string - (+ 1 i (car arity))))) - arglist)))) - (nreverse arglist))) + ((or (and (byte-code-function-p def) (integerp (aref def 0))) + (subrp def)) + (or (when preserve-names + (let* ((doc (condition-case nil (documentation def) (error nil))) + (docargs (if doc (car (help-split-fundoc doc nil)))) + (arglist (if docargs + (cdar (read-from-string (downcase docargs))))) + (valid t)) + ;; Check validity. + (dolist (arg arglist) + (unless (and (symbolp arg) + (let ((name (symbol-name arg))) + (if (eq (aref name 0) ?&) + (memq arg '(&rest &optional)) + (not (string-match "\\." name))))) + (setq valid nil))) + (when valid arglist))) + (let* ((args-desc (if (not (subrp def)) + (aref def 0) + (let ((a (subr-arity def))) + (logior (car a) + (if (numberp (cdr a)) + (lsh (cdr a) 8) + (lsh 1 7)))))) + (max (lsh args-desc -8)) + (min (logand args-desc 127)) + (rest (logand args-desc 128)) + (arglist ())) + (dotimes (i min) + (push (intern (concat "arg" (number-to-string (1+ i)))) arglist)) + (when (> max min) + (push '&optional arglist) + (dotimes (i (- max min)) + (push (intern (concat "arg" (number-to-string (+ 1 i min)))) + arglist))) + (unless (zerop rest) (push '&rest arglist) (push 'rest arglist)) + (nreverse arglist)))) ((and (eq (car-safe def) 'autoload) (not (eq (nth 4 def) 'keymap))) "[Arg list not available until function definition is loaded.]") (t t))) diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 490b2b2ebfc..ab67fcfcdfd 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -179,8 +179,11 @@ otherwise turn it off." (if icomplete-mode ;; The following is not really necessary after first time - ;; no great loss. - (add-hook 'minibuffer-setup-hook 'icomplete-minibuffer-setup) - (remove-hook 'minibuffer-setup-hook 'icomplete-minibuffer-setup))) + (progn + (setq completion-show-inline-help nil) + (add-hook 'minibuffer-setup-hook 'icomplete-minibuffer-setup)) + (remove-hook 'minibuffer-setup-hook 'icomplete-minibuffer-setup) + (setq completion-show-inline-help t))) ;;;_ > icomplete-simple-completing-p () (defun icomplete-simple-completing-p () diff --git a/lisp/ido.el b/lisp/ido.el index 0ce83d9b88c..9606879ce70 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -2176,9 +2176,7 @@ If cursor is not at the end of the user input, move to end of input." (ido-current-directory nil) (ido-directory-nonreadable nil) (ido-directory-too-big nil) - (ido-use-virtual-buffers (if (eq method 'kill) - nil ;; Don't consider virtual buffers for killing - ido-use-virtual-buffers)) + (ido-use-virtual-buffers ido-use-virtual-buffers) (require-match (confirm-nonexistent-file-or-buffer)) (buf (ido-read-internal 'buffer (or prompt "Buffer: ") 'ido-buffer-history default require-match initial)) @@ -3917,10 +3915,10 @@ If cursor is not at the end of the user input, delete to end of input." (let ((enable-recursive-minibuffers t) (buf (ido-name (car ido-matches))) (nextbuf (cadr ido-matches))) - (when (get-buffer buf) + (cond + ((get-buffer buf) ;; If next match names a buffer use the buffer object; buffer - ;; name may be changed by packages such as uniquify; mindful - ;; of virtual buffers. + ;; name may be changed by packages such as uniquify. (when (and nextbuf (get-buffer nextbuf)) (setq nextbuf (get-buffer nextbuf))) (if (null (kill-buffer buf)) @@ -3934,7 +3932,13 @@ If cursor is not at the end of the user input, delete to end of input." (setq ido-default-item nextbuf ido-text-init ido-text ido-exit 'refresh) - (exit-minibuffer)))))) + (exit-minibuffer))) + ;; Handle virtual buffers + ((assoc buf ido-virtual-buffers) + (setq recentf-list + (delete (cdr (assoc buf ido-virtual-buffers)) recentf-list)) + (setq ido-cur-list (delete buf ido-cur-list)) + (setq ido-rescan t)))))) ;;; DELETE CURRENT FILE (defun ido-delete-file-at-head () diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 96d874dbec6..c99689f33ad 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -610,7 +610,7 @@ takes effect only if Emacs is compiled with ImageMagick support." This command has no effect unless Emacs is compiled with ImageMagick support." (interactive "nScale: ") - (setq image-transform-resize resize) + (setq image-transform-resize scale) (image-toggle-display-image)) (defun image-transform-fit-to-height () diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 19084aad5d6..0d26d6bdcf6 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -58,6 +58,10 @@ ;;; Todo: +;; - completion-insert-complete-hook (called after inserting a complete +;; completion), typically used for "complete-abbrev" where it would expand +;; the abbrev. Tho we'd probably want to provide it from the +;; completion-table. ;; - extend `boundaries' to provide various other meta-data about the ;; output of `all-completions': ;; - preferred sorting order when displayed in *Completions*. @@ -381,6 +385,9 @@ If the current buffer is not a minibuffer, erase its entire contents." ;; is on, the field doesn't cover the entire minibuffer contents. (delete-region (minibuffer-prompt-end) (point-max))) +(defvar completion-show-inline-help t + "If non-nil, print helpful inline messages during completion.") + (defcustom completion-auto-help t "Non-nil means automatically provide help for invalid completion input. If the value is t the *Completion* buffer is displayed whenever completion @@ -568,8 +575,9 @@ E = after completion we now have an Exact match. (cond ((null comp) (minibuffer-hide-completions) - (unless completion-fail-discreetly - (ding) (minibuffer-message "No match")) + (when (and (not completion-fail-discreetly) completion-show-inline-help) + (ding) + (minibuffer-message "No match")) (minibuffer--bitset nil nil nil)) ((eq t comp) (minibuffer-hide-completions) @@ -639,9 +647,10 @@ E = after completion we now have an Exact match. (minibuffer-hide-completions)) ;; Show the completion table, if requested. ((not exact) - (if (case completion-auto-help - (lazy (eq this-command last-command)) - (t completion-auto-help)) + (if (cond ((null completion-show-inline-help) t) + ((eq completion-auto-help 'lazy) + (eq this-command last-command)) + (t completion-auto-help)) (minibuffer-completion-help) (minibuffer-message "Next char not unique"))) ;; If the last exact completion and this one were the same, it @@ -683,9 +692,11 @@ scroll the window of possible completions." t) (t (case (completion--do-completion) (#b000 nil) - (#b001 (minibuffer-message "Sole completion") + (#b001 (if completion-show-inline-help + (minibuffer-message "Sole completion")) t) - (#b011 (minibuffer-message "Complete, but not unique") + (#b011 (if completion-show-inline-help + (minibuffer-message "Complete, but not unique")) t) (t t))))) @@ -743,7 +754,9 @@ Repeated uses step through the possible completions." (end (field-end)) (all (completion-all-sorted-completions))) (if (not (consp all)) - (minibuffer-message (if all "No more completions" "No completions")) + (if completion-show-inline-help + (minibuffer-message + (if all "No more completions" "No completions"))) (setq completion-cycling t) (goto-char end) (insert (car all)) @@ -931,9 +944,11 @@ Return nil if there is no valid completion, else t." (interactive) (case (completion--do-completion 'completion--try-word-completion) (#b000 nil) - (#b001 (minibuffer-message "Sole completion") + (#b001 (if completion-show-inline-help + (minibuffer-message "Sole completion")) t) - (#b011 (minibuffer-message "Complete, but not unique") + (#b011 (if completion-show-inline-help + (minibuffer-message "Complete, but not unique")) t) (t t))) @@ -1243,12 +1258,22 @@ and PREDICATE, either by calling NEXT-FUN or by doing it themselves.") (defvar completion-in-region--data nil) +(defvar completion-in-region-mode-predicate nil + "Predicate to tell `completion-in-region-mode' when to exit. +It is called with no argument and should return nil when +`completion-in-region-mode' should exit (and hence pop down +the *Completions* buffer).") + +(defvar completion-in-region-mode--predicate nil + "Copy of the value of `completion-in-region-mode-predicate'. +This holds the value `completion-in-region-mode-predicate' had when +we entered `completion-in-region-mode'.") + (defun completion-in-region (start end collection &optional predicate) "Complete the text between START and END using COLLECTION. Return nil if there is no valid completion, else t. Point needs to be somewhere between START and END." (assert (<= start (point)) (<= (point) end)) - ;; FIXME: undisplay the *Completions* buffer once the completion is done. (with-wrapper-hook ;; FIXME: Maybe we should use this hook to provide a "display ;; completions" operation as well. @@ -1257,9 +1282,10 @@ Point needs to be somewhere between START and END." (minibuffer-completion-predicate predicate) (ol (make-overlay start end nil nil t))) (overlay-put ol 'field 'completion) - (completion-in-region-mode 1) - (setq completion-in-region--data - (list (current-buffer) start end collection)) + (when completion-in-region-mode-predicate + (completion-in-region-mode 1) + (setq completion-in-region--data + (list (current-buffer) start end collection))) (unwind-protect (call-interactively 'minibuffer-complete) (delete-overlay ol))))) @@ -1288,13 +1314,8 @@ Point needs to be somewhere between START and END." (save-excursion (goto-char (nth 2 completion-in-region--data)) (line-end-position))) - (let ((comp-data (run-hook-wrapped - 'completion-at-point-functions - ;; Only use the known-safe functions. - #'completion--capf-wrapper 'safe))) - (eq (car comp-data) - ;; We're still in the same completion field. - (nth 1 completion-in-region--data))))) + (when completion-in-region-mode--predicate + (funcall completion-in-region-mode--predicate)))) (completion-in-region-mode -1))) ;; (defalias 'completion-in-region--prech 'completion-in-region--postch) @@ -1309,9 +1330,12 @@ Point needs to be somewhere between START and END." (delq (assq 'completion-in-region-mode minor-mode-overriding-map-alist) minor-mode-overriding-map-alist)) (if (null completion-in-region-mode) - (unless (equal "*Completions*" (buffer-name (window-buffer))) + (unless (or (equal "*Completions*" (buffer-name (window-buffer))) + (null completion-in-region-mode--predicate)) (minibuffer-hide-completions)) ;; (add-hook 'pre-command-hook #'completion-in-region--prech) + (set (make-local-variable 'completion-in-region-mode--predicate) + completion-in-region-mode-predicate) (add-hook 'post-command-hook #'completion-in-region--postch) (push `(completion-in-region-mode . ,completion-in-region-mode-map) minor-mode-overriding-map-alist))) @@ -1355,7 +1379,7 @@ Currently supported properties are: (message "Completion function %S uses a deprecated calling convention" fun) (push fun completion--capf-misbehave-funs)))) - res))) + (if res (cons fun res))))) (defun completion-at-point () "Perform completion on the text around point. @@ -1363,18 +1387,20 @@ The completion method is determined by `completion-at-point-functions'." (interactive) (let ((res (run-hook-wrapped 'completion-at-point-functions #'completion--capf-wrapper 'all))) - (cond - ((functionp res) (funcall res)) - ((consp res) - (let* ((plist (nthcdr 3 res)) - (start (nth 0 res)) - (end (nth 1 res)) - (completion-annotate-function + (pcase res + (`(,_ . ,(and (pred functionp) f)) (funcall f)) + (`(,hookfun . (,start ,end ,collection . ,plist)) + (let* ((completion-annotate-function (or (plist-get plist :annotation-function) - completion-annotate-function))) - (completion-in-region start end (nth 2 res) + completion-annotate-function)) + (completion-in-region-mode-predicate + (lambda () + ;; We're still in the same completion field. + (eq (car (funcall hookfun)) start)))) + (completion-in-region start end collection (plist-get plist :predicate)))) - (res)))) ;Maybe completion already happened and the function returned t. + ;; Maybe completion already happened and the function returned t. + (_ (cdr res))))) (defun completion-help-at-point () "Display the completions on the text around point. @@ -1383,29 +1409,36 @@ The completion method is determined by `completion-at-point-functions'." (let ((res (run-hook-wrapped 'completion-at-point-functions ;; Ignore misbehaving functions. #'completion--capf-wrapper 'optimist))) - (cond - ((functionp res) - (message "Don't know how to show completions for %S" res)) - ((consp res) - (let* ((plist (nthcdr 3 res)) - (minibuffer-completion-table (nth 2 res)) + (pcase res + (`(,_ . ,(and (pred functionp) f)) + (message "Don't know how to show completions for %S" f)) + (`(,hookfun . (,start ,end ,collection . ,plist)) + (let* ((minibuffer-completion-table collection) (minibuffer-completion-predicate (plist-get plist :predicate)) (completion-annotate-function (or (plist-get plist :annotation-function) completion-annotate-function)) - (ol (make-overlay (nth 0 res) (nth 1 res) nil nil t))) + (completion-in-region-mode-predicate + (lambda () + ;; We're still in the same completion field. + (eq (car (funcall hookfun)) start))) + (ol (make-overlay start end nil nil t))) ;; FIXME: We should somehow (ab)use completion-in-region-function or ;; introduce a corresponding hook (plus another for word-completion, ;; and another for force-completion, maybe?). (overlay-put ol 'field 'completion) + (completion-in-region-mode 1) + (setq completion-in-region--data + (list (current-buffer) start end collection)) (unwind-protect (call-interactively 'minibuffer-completion-help) (delete-overlay ol)))) - (res + (`(,hookfun . ,_) ;; The hook function already performed completion :-( ;; Not much we can do at this point. + (message "%s already performed completion!" hookfun) nil) - (t (message "Nothing to complete at point"))))) + (_ (message "Nothing to complete at point"))))) ;;; Key bindings. diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el index 070cd2641db..67bb7eae68e 100644 --- a/lisp/net/network-stream.el +++ b/lisp/net/network-stream.el @@ -171,9 +171,11 @@ values: (resulting-type 'plain) starttls-command) - ;; If we have STARTTLS support, try to upgrade the connection. + ;; If we have built-in STARTTLS support, try to upgrade the + ;; connection. (when (and (or (fboundp 'open-gnutls-stream) - (executable-find "gnutls-cli")) + (and require-tls + (executable-find "gnutls-cli"))) capabilities success-string starttls-function (setq starttls-command (funcall starttls-function capabilities))) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index ec5c46b2897..cb4aca12edb 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -1145,13 +1145,15 @@ target of the symlink differ." (save-excursion (tramp-convert-file-attributes v - (cond - ((tramp-get-remote-stat v) - (tramp-do-file-attributes-with-stat v localname id-format)) - ((tramp-get-remote-perl v) - (tramp-do-file-attributes-with-perl v localname id-format)) - (t - (tramp-do-file-attributes-with-ls v localname id-format))))))))) + (or + (cond + ((tramp-get-remote-stat v) + (tramp-do-file-attributes-with-stat v localname id-format)) + ((tramp-get-remote-perl v) + (tramp-do-file-attributes-with-perl v localname id-format)) + (t nil)) + ;; The scripts could fail, for example with huge file size. + (tramp-do-file-attributes-with-ls v localname id-format)))))))) (defun tramp-do-file-attributes-with-ls (vec localname &optional id-format) "Implement `file-attributes' for Tramp files using the ls(1) command." @@ -2296,10 +2298,9 @@ The method used must be an out-of-band method." (tramp-get-method-parameter method 'tramp-copy-env)))) ;; Check for program. - (when (and (fboundp 'executable-find) - (not (let ((default-directory - (tramp-compat-temporary-file-directory))) - (executable-find copy-program)))) + (unless (let ((default-directory + (tramp-compat-temporary-file-directory))) + (executable-find copy-program)) (tramp-error v 'file-error "Cannot find copy program: %s" copy-program)) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 7e1b0f5b8e9..36477f7b439 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -339,7 +339,7 @@ pass to the OPERATION." preserve-uid-gid preserve-selinux-context) "Like `copy-file' for Tramp files. KEEP-DATE is not handled in case NEWNAME resides on an SMB server. -PRESERVE-UID-GID is completely ignored." +PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored." (setq filename (expand-file-name filename) newname (expand-file-name newname)) (with-progress-reporter diff --git a/src/ChangeLog b/src/ChangeLog index 29b2457e08a..2b0df1f7a30 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,8 +1,6 @@ 2011-04-14 Paul Eggert <eggert@cs.ucla.edu> - * lisp.h (INFUN): Remove. Suggested by Dan Nicolaescu in - <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00393.html>. - All uses spelled out. + Improve C-level modularity by making more things 'static'. Don't publish debugger-only interfaces to other modules. * lisp.h (safe_debug_print, debug_output_compilation_hack): @@ -49,7 +47,7 @@ (get_tty_terminal): Now static. (term_mouse_moveto): Do not define if HAVE_WINDOW_SYSTEM. * termhooks.h (term_mouse_moveto): Do not declare if - HAVE_WINDOW_SYSTEMM. + HAVE_WINDOW_SYSTEM. * dispextern.h (tty_set_terminal_modes, tty_reset_terminal_modes): (tty_turn_off_highlight, get_tty_terminal): Remove decls. @@ -132,8 +130,6 @@ Now static. * intervals.h (merge_interval_right, delete_interval): Remove decls. -2011-04-13 Paul Eggert <eggert@cs.ucla.edu> - * insdel.c: Make symbols static if they're not exported. However, leave prepare_to_modify_buffer alone. It's never called from outside this function, but that appears to be a bug. @@ -218,8 +214,6 @@ (xic_create_fontsetname): Declare only if HAVE_X_WINDOWS && USE_X_TOOLKIT. -2011-04-12 Paul Eggert <eggert@cs.ucla.edu> - * ftxfont.c: Make symbols static if they're not exported. (ftxfont_driver): Export only if !defined HAVE_XFT && def8ined HAVE_FREETYPE. @@ -281,8 +275,6 @@ * lisp.h (circular_list_error, FOREACH): Remove; unused. * data.c (circular_list_error): Remove. -2011-04-11 Paul Eggert <eggert@cs.ucla.edu> - * commands.h (last_point_position, last_point_position_buffer): (last_point_position_window): Remove decls. * keyboard.c: Make these variables static. @@ -370,11 +362,8 @@ to see whether these functions can be called from other modules. DEFUN now defines a static function. To make the function external so that it can be used in other C modules, use the new macro DEFUE. - * lisp.h (DEFINE_FUNC): New macro, with the old contents of DEFUN. - (DEFUN): Rewrite in terms of DEFINE_FUNC. It now generates a - static function definition. Use DEFUE if you want an extern one. - (DEFUE, INFUN): New macros. - (Funibyte_char_to_multibyte, Fsyntax_table_p, Finit_image_library): + * lisp.h (Funibyte_char_to_multibyte, Fsyntax_table_p): + (Finit_image_library): (Feval_region, Fbacktrace, Ffetch_bytecode, Fswitch_to_buffer): (Ffile_executable_p, Fmake_symbolic_link, Fcommand_execute): (Fget_process, Fdocumentation_property, Fbyte_code, Ffile_attributes): @@ -423,12 +412,63 @@ (Fset_window_margins, Fset_window_vscroll): New forward static decls. * window.h (Fset_window_vscroll, Fset_window_margins): Remove decls. -2011-04-10 Paul Eggert <eggert@cs.ucla.edu> - * editfns.c (Fformat): Remove unreachable code. +2011-04-14 Andreas Schwab <schwab@linux-m68k.org> + + * fileio.c (Finsert_file_contents): Fix typo in 2005-05-13 + change. (Bug#8496) + +2011-04-13 Eli Zaretskii <eliz@gnu.org> + + * xdisp.c (handle_invisible_prop): Don't call bidi_paragraph_init + when at ZV. (Bug#8487) + +2011-04-12 Andreas Schwab <schwab@linux-m68k.org> + + * charset.c (Fclear_charset_maps): Use xfree instead of free. + (Bug#8437) + * keyboard.c (parse_tool_bar_item): Likewise. + * sound.c (sound_cleanup, alsa_close): Likewise. + * termcap.c (tgetent): Likewise. + * xfns.c (x_default_font_parameter): Likewise. + * xsettings.c (read_and_apply_settings): Likewise. + + * alloc.c (overrun_check_malloc, overrun_check_realloc) + (overrun_check_free): Protoize. + +2011-04-12 Paul Eggert <eggert@cs.ucla.edu> + + * sysdep.c (emacs_read, emacs_write): Check for negative sizes + since callers should never pass a negative size. + Change the signature to match that of plain 'read' and 'write'; see + <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00397.html>. + * lisp.h: Update prototypes of emacs_write and emacs_read. + +2011-04-11 Eli Zaretskii <eliz@gnu.org> + + * xdisp.c (redisplay_window): Don't try to determine the character + position of the scroll margin if the window start point w->startp + is outside the buffer's accessible region. (Bug#8468) + +2011-04-10 Eli Zaretskii <eliz@gnu.org> + + Fix write-region and its subroutines for buffers > 2GB. + * fileio.c (a_write, e_write): Modify declaration of arguments and + local variables to support buffers larger than 2GB. + (Fcopy_file): Use EMACS_INT for return value of emacs_read. + + * sysdep.c (emacs_write, emacs_read): Use ssize_t for last + argument, local variables, and return value. + + * lisp.h: Update prototypes of emacs_write and emacs_read. + + * sound.c (vox_write): Use ssize_t for return value of emacs_write. + 2011-04-10 Paul Eggert <eggert@cs.ucla.edu> + * xdisp.c (vmessage): Use memchr, not strnlen, which some hosts lack. + Fix more problems found by GCC 4.6.0's static checks. * xdisp.c (vmessage): Use a better test for character truncation. @@ -534,7 +574,7 @@ * xselect.c (x_decline_selection_request) (x_reply_selection_request): Avoid type-punned deref of X events. -2011-04-09 Eli Zaretskii <eliz@emacstest.gnu.org> +2011-04-09 Eli Zaretskii <eliz@gnu.org> Fix some uses of `int' instead of EMACS_INT. * search.c (string_match_1, fast_string_match) diff --git a/src/ChangeLog.11 b/src/ChangeLog.11 index 703b084743c..6f462e32534 100644 --- a/src/ChangeLog.11 +++ b/src/ChangeLog.11 @@ -4906,7 +4906,7 @@ (Finternal_describe_syntax_value): Recognize new flag; use the SYNTAX_FLAGS_* macros. (scan_sexps_forward, Fparse_partial_sexp): Change representation of - comment style to accomodate the new styles. + comment style to accommodate the new styles. (back_comment, forw_comment, Fforward_comment, scan_lists) (scan_sexps_forward): Update code to obey the new comment style flag. diff --git a/src/alloc.c b/src/alloc.c index 1c793c985eb..16cd183aaa1 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -565,8 +565,7 @@ static int check_depth; /* Like malloc, but wraps allocated block with header and trailer. */ POINTER_TYPE * -overrun_check_malloc (size) - size_t size; +overrun_check_malloc (size_t size) { register unsigned char *val; size_t overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_SIZE*2 : 0; @@ -590,11 +589,9 @@ overrun_check_malloc (size) with header and trailer. */ POINTER_TYPE * -overrun_check_realloc (block, size) - POINTER_TYPE *block; - size_t size; +overrun_check_realloc (POINTER_TYPE *block, size_t size) { - register unsigned char *val = (unsigned char *)block; + register unsigned char *val = (unsigned char *) block; size_t overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_SIZE*2 : 0; if (val @@ -630,10 +627,9 @@ overrun_check_realloc (block, size) /* Like free, but checks block for overrun. */ void -overrun_check_free (block) - POINTER_TYPE *block; +overrun_check_free (POINTER_TYPE *block) { - unsigned char *val = (unsigned char *)block; + unsigned char *val = (unsigned char *) block; ++check_depth; if (val diff --git a/src/charset.c b/src/charset.c index cc7c53ae61c..c4699dcb0a7 100644 --- a/src/charset.c +++ b/src/charset.c @@ -2143,7 +2143,7 @@ It should be called only from temacs invoked for dumping. */) { if (temp_charset_work) { - free (temp_charset_work); + xfree (temp_charset_work); temp_charset_work = NULL; } diff --git a/src/fileio.c b/src/fileio.c index 7f749536d56..b8c5e796db4 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -146,8 +146,10 @@ static Lisp_Object Qcar_less_than_car; static Lisp_Object Fmake_symbolic_link (Lisp_Object, Lisp_Object, Lisp_Object); static int a_write (int, Lisp_Object, int, int, +static int a_write (int, Lisp_Object, EMACS_INT, EMACS_INT, Lisp_Object *, struct coding_system *); -static int e_write (int, Lisp_Object, int, int, struct coding_system *); +static int e_write (int, Lisp_Object, EMACS_INT, EMACS_INT, + struct coding_system *); void @@ -1808,7 +1810,8 @@ If PRESERVE-SELINUX-CONTEXT is non-nil and SELinux is enabled on the system, we copy the SELinux context of FILE to NEWNAME. */) (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists, Lisp_Object keep_time, Lisp_Object preserve_uid_gid, Lisp_Object preserve_selinux_context) { - int ifd, ofd, n; + int ifd, ofd; + EMACS_INT n; char buf[16 * 1024]; struct stat st, out_st; Lisp_Object handler; @@ -3802,9 +3805,7 @@ variable `last-coding-system-used' to the coding system actually used. */) /* For a special file, all we can do is guess. */ total = READ_BUF_SIZE; - /* FIXME: This if-statement is a no-op, because 'inserted' must be zero here - (Bug#8496). */ - if (NILP (visit) && inserted > 0) + if (NILP (visit) && total > 0) { #ifdef CLASH_DETECTION if (!NILP (BVAR (current_buffer, file_truename)) @@ -3914,7 +3915,6 @@ variable `last-coding-system-used' to the coding system actually used. */) if (inserted == 0) { #ifdef CLASH_DETECTION - /* FIXME: This code is a no-op, too (Bug#8496). */ if (we_locked_file) unlock_file (BVAR (current_buffer, file_truename)); #endif @@ -4799,11 +4799,13 @@ build_annotations (Lisp_Object start, Lisp_Object end) The return value is negative in case of system call failure. */ static int -a_write (int desc, Lisp_Object string, int pos, register int nchars, Lisp_Object *annot, struct coding_system *coding) +a_write (int desc, Lisp_Object string, EMACS_INT pos, + register EMACS_INT nchars, Lisp_Object *annot, + struct coding_system *coding) { Lisp_Object tem; - int nextpos; - int lastpos = pos + nchars; + EMACS_INT nextpos; + EMACS_INT lastpos = pos + nchars; while (NILP (*annot) || CONSP (*annot)) { @@ -4843,7 +4845,8 @@ a_write (int desc, Lisp_Object string, int pos, register int nchars, Lisp_Object are indexes to the string STRING. */ static int -e_write (int desc, Lisp_Object string, int start, int end, struct coding_system *coding) +e_write (int desc, Lisp_Object string, EMACS_INT start, EMACS_INT end, + struct coding_system *coding) { if (STRINGP (string)) { @@ -4874,8 +4877,8 @@ e_write (int desc, Lisp_Object string, int start, int end, struct coding_system } else { - int start_byte = CHAR_TO_BYTE (start); - int end_byte = CHAR_TO_BYTE (end); + EMACS_INT start_byte = CHAR_TO_BYTE (start); + EMACS_INT end_byte = CHAR_TO_BYTE (end); coding->src_multibyte = (end - start) < (end_byte - start_byte); if (CODING_REQUIRE_ENCODING (coding)) diff --git a/src/keyboard.c b/src/keyboard.c index 28e7e5bd463..7895d05b34f 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -8270,7 +8270,7 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) PROP (TOOL_BAR_ITEM_LABEL) = new_lbl; else PROP (TOOL_BAR_ITEM_LABEL) = make_string ("", 0); - free (buf); + xfree (buf); } /* If got a filter apply it on binding. */ diff --git a/src/lisp.h b/src/lisp.h index 09830a980f2..8b8e25eb689 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3316,8 +3316,8 @@ extern long get_random (void); extern void seed_random (long); extern int emacs_open (const char *, int, int); extern int emacs_close (int); -extern int emacs_read (int, char *, unsigned int); -extern int emacs_write (int, const char *, unsigned int); +extern ssize_t emacs_read (int, char *, size_t); +extern ssize_t emacs_write (int, const char *, size_t); enum { READLINK_BUFSIZE = 1024 }; extern char *emacs_readlink (const char *, char [READLINK_BUFSIZE]); #ifndef HAVE_MEMSET diff --git a/src/sound.c b/src/sound.c index e121b5e37f3..697e81c814b 100644 --- a/src/sound.c +++ b/src/sound.c @@ -460,8 +460,8 @@ sound_cleanup (Lisp_Object arg) current_sound_device->close (current_sound_device); if (current_sound->fd > 0) emacs_close (current_sound->fd); - free (current_sound_device); - free (current_sound); + xfree (current_sound_device); + xfree (current_sound); return Qnil; } @@ -897,7 +897,7 @@ vox_init (struct sound_device *sd) static void vox_write (struct sound_device *sd, const char *buffer, int nbytes) { - int nwritten = emacs_write (sd->fd, buffer, nbytes); + ssize_t nwritten = emacs_write (sd->fd, buffer, nbytes); if (nwritten < 0) sound_perror ("Error writing to sound device"); } @@ -1095,7 +1095,7 @@ alsa_close (struct sound_device *sd) snd_pcm_drain (p->handle); snd_pcm_close (p->handle); } - free (p); + xfree (p); } } diff --git a/src/sysdep.c b/src/sysdep.c index 3dc255933ee..0d9b31f35cd 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1825,10 +1825,18 @@ emacs_close (int fd) return rtnval; } -int -emacs_read (int fildes, char *buf, unsigned int nbyte) +ssize_t +emacs_read (int fildes, char *buf, size_t nbyte) { - register int rtnval; + register ssize_t rtnval; + + /* Defend against the possibility that a buggy caller passes a negative NBYTE + argument, which would be converted to a large unsigned size_t NBYTE. This + defense prevents callers from doing large writes, unfortunately. This + size restriction can be removed once we have carefully checked that there + are no such callers. */ + if ((ssize_t) nbyte < 0) + abort (); while ((rtnval = read (fildes, buf, nbyte)) == -1 && (errno == EINTR)) @@ -1836,14 +1844,18 @@ emacs_read (int fildes, char *buf, unsigned int nbyte) return (rtnval); } -int -emacs_write (int fildes, const char *buf, unsigned int nbyte) +ssize_t +emacs_write (int fildes, const char *buf, size_t nbyte) { - register int rtnval, bytes_written; + register ssize_t rtnval, bytes_written; + + /* Defend against negative NBYTE, as in emacs_read. */ + if ((ssize_t) nbyte < 0) + abort (); bytes_written = 0; - while (nbyte > 0) + while (nbyte != 0) { rtnval = write (fildes, buf, nbyte); diff --git a/src/termcap.c b/src/termcap.c index 27a20a67ae1..5b71ad229d7 100644 --- a/src/termcap.c +++ b/src/termcap.c @@ -1,6 +1,6 @@ /* Work-alike for termcap, plus extra features. Copyright (C) 1985, 1986, 1993, 1994, 1995, 2000, 2001, 2002, 2003, - 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + 2004, 2005, 2006, 2007, 2008, 2011 Free Software Foundation, Inc. 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 @@ -468,15 +468,15 @@ tgetent (char *bp, const char *name) if (scan_file (term, fd, &buf) == 0) { close (fd); - free (buf.beg); + xfree (buf.beg); if (malloc_size) - free (bp); + xfree (bp); return 0; } /* Free old `term' if appropriate. */ if (term != name) - free (term); + xfree (term); /* If BP is malloc'd by us, make sure it is big enough. */ if (malloc_size) @@ -506,7 +506,7 @@ tgetent (char *bp, const char *name) } close (fd); - free (buf.beg); + xfree (buf.beg); if (malloc_size) bp = (char *) xrealloc (bp, bp1 - bp + 1); diff --git a/src/xdisp.c b/src/xdisp.c index 3370d84d67f..4f1830f4c6c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -3617,7 +3617,7 @@ handle_invisible_prop (struct it *it) _after_ bidi iteration avoids affecting the visual order of the displayed text when invisible properties are added or removed. */ - if (it->bidi_it.first_elt) + if (it->bidi_it.first_elt && it->bidi_it.charpos < ZV) { /* If we were `reseat'ed to a new paragraph, determine the paragraph base direction. We need @@ -8374,10 +8374,13 @@ vmessage (const char *m, va_list ap) /* Do any truncation at a character boundary. */ if (! (0 <= len && len < bufsize)) - for (len = strnlen (buf, bufsize); - len && ! CHAR_HEAD_P (buf[len - 1]); - len--) - continue; + { + char *end = memchr (buf, 0, bufsize); + for (len = end ? end - buf : bufsize; + len && ! CHAR_HEAD_P (buf[len - 1]); + len--) + continue; + } message2 (FRAME_MESSAGE_BUF (f), len, 0); } @@ -14206,7 +14209,14 @@ redisplay_window (Lisp_Object window, int just_this_one_p) /* If there is a scroll margin at the top of the window, find its character position. */ - if (margin) + if (margin + /* Cannot call start_display if startp is not in the + accessible region of the buffer. This can happen when we + have just switched to a different buffer and/or changed + its restriction. In that case, startp is initialized to + the character position 1 (BEG) because we did not yet + have chance to display the buffer even once. */ + && BEGV <= CHARPOS (startp) && CHARPOS (startp) <= ZV) { struct it it1; diff --git a/src/xfns.c b/src/xfns.c index 1182ef8e770..290b6161215 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -2958,7 +2958,7 @@ x_default_font_parameter (struct frame *f, Lisp_Object parms) { char *name = xstrdup (system_font); font = font_open_by_name (f, name); - free (name); + xfree (name); } } diff --git a/src/xsettings.c b/src/xsettings.c index d09b702a428..2513bcc5aa8 100644 --- a/src/xsettings.c +++ b/src/xsettings.c @@ -566,20 +566,20 @@ read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p) if (send_event_p) store_config_changed_event (Qtool_bar_style, dpyname); } - free (settings.tb_style); + xfree (settings.tb_style); } if (settings.seen & SEEN_FONT) { if (!current_font || strcmp (current_font, settings.font) != 0) { - free (current_font); + xfree (current_font); current_font = settings.font; if (send_event_p) store_config_changed_event (Qfont_name, dpyname); } else - free (settings.font); + xfree (settings.font); } } |