From: Paul Eggert Date: Tue, 17 Apr 2012 21:38:34 +0000 (-0700) Subject: Merge from trunk. X-Git-Url: http://git.hcoop.net/bpt/emacs.git/commitdiff_plain/ae6e112df045de8ddc22e85f8538975d4664b325?hp=ad85a071cc6d583041969d300793c92f21a54696 Merge from trunk. --- diff --git a/ChangeLog b/ChangeLog index 99ce37a2fe..6020d15779 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2012-04-14 Paul Eggert +2012-04-17 Paul Eggert configure: new option --enable-gcc-warnings (Bug#11207) I have been using this change for many months in my private copy @@ -15,6 +15,17 @@ * lib/Makefile.am (AM_CFLAGS): New macro. * m4/manywarnings.m4, m4/warnings.m4: New files, from gnulib. +2012-04-17 Dmitry Antipov + + * configure.in (AC_CHECK_FUNCS): + Add getpwent, endpwent, getgrent, endgrent. (Bug#7900) + +2012-04-16 Glenn Morris + + * configure.in (NS_HAVE_NSINTEGER): Remove unnecessary variable. + + * configure.in: Remove X libs workaround for old autoconf. + 2012-04-12 Ken Brown * configure.in: Warn that Cygwin 1.5 is unsupported. (Bug#10398) diff --git a/autogen/config.in b/autogen/config.in index e93bd7f325..c64b048ade 100644 --- a/autogen/config.in +++ b/autogen/config.in @@ -203,6 +203,12 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if you have the 'dup2' function. */ #undef HAVE_DUP2 +/* Define to 1 if you have the `endgrent' function. */ +#undef HAVE_ENDGRENT + +/* Define to 1 if you have the `endpwent' function. */ +#undef HAVE_ENDPWENT + /* Define to 1 if you have the `euidaccess' function. */ #undef HAVE_EUIDACCESS @@ -254,6 +260,9 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if you have the `getdomainname' function. */ #undef HAVE_GETDOMAINNAME +/* Define to 1 if you have the `getgrent' function. */ +#undef HAVE_GETGRENT + /* Define to 1 if you have the `gethostname' function. */ #undef HAVE_GETHOSTNAME @@ -278,6 +287,9 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if you have the `getpt' function. */ #undef HAVE_GETPT +/* Define to 1 if you have the `getpwent' function. */ +#undef HAVE_GETPWENT + /* Define to 1 if you have the `getrlimit' function. */ #undef HAVE_GETRLIMIT diff --git a/autogen/configure b/autogen/configure index de24a151fc..dd88948322 100755 --- a/autogen/configure +++ b/autogen/configure @@ -9656,15 +9656,6 @@ else window_system=x11 fi -## Workaround for bug in autoconf <= 2.62. -## http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01551.html -## No need to do anything special for these standard directories. -if test -n "${x_libraries}" && test x"${x_libraries}" != xNONE; then - - x_libraries=`echo :${x_libraries}: | sed -e 's|:/usr/lib64:|:|g' -e 's|:/lib64:|:|g' -e 's|^:||' -e 's|:$||'` - -fi - LD_SWITCH_X_SITE_AUX= LD_SWITCH_X_SITE_AUX_RPATH= if test "${x_libraries}" != NONE; then @@ -9803,7 +9794,6 @@ else fi - NS_HAVE_NSINTEGER=yes cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -9821,8 +9811,10 @@ else ns_have_nsinteger=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $ns_have_nsinteger = no; then - NS_HAVE_NSINTEGER=no + if test $ns_have_nsinteger = yes; then + +$as_echo "#define NS_HAVE_NSINTEGER 1" >>confdefs.h + fi fi @@ -13434,11 +13426,6 @@ $as_echo "#define NS_IMPL_GNUSTEP 1" >>confdefs.h ## Extra CFLAGS applied to src/*.m files. GNU_OBJC_CFLAGS="$GNU_OBJC_CFLAGS -fgnu-runtime -Wno-import -fconstant-string-class=NSConstantString -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGSWARN -DGSDIAGNOSE" fi - if test "${NS_HAVE_NSINTEGER}" = "yes"; then - -$as_echo "#define NS_HAVE_NSINTEGER 1" >>confdefs.h - - fi # We also have mouse menus. HAVE_MENUS=yes OTHER_FILES=ns-app @@ -13967,6 +13954,7 @@ __fpending mblen mbrlen mbsinit strsignal setitimer ualarm \ sendto recvfrom getsockopt setsockopt getsockname getpeername \ gai_strerror mkstemp getline getdelim mremap fsync sync \ difftime mempcpy mblen mbrlen posix_memalign \ +getpwent endpwent getgrent endgrent \ cfmakeraw cfsetspeed copysign __executable_start do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` diff --git a/configure.in b/configure.in index 8be0da2ab2..6b60e2214f 100644 --- a/configure.in +++ b/configure.in @@ -1500,15 +1500,6 @@ else window_system=x11 fi -## Workaround for bug in autoconf <= 2.62. -## http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01551.html -## No need to do anything special for these standard directories. -if test -n "${x_libraries}" && test x"${x_libraries}" != xNONE; then - - x_libraries=`echo :${x_libraries}: | sed -e 's|:/usr/lib64:|:|g' -e 's|:/lib64:|:|g' -e 's|^:||' -e 's|:$||'` - -fi - LD_SWITCH_X_SITE_AUX= LD_SWITCH_X_SITE_AUX_RPATH= if test "${x_libraries}" != NONE; then @@ -1629,13 +1620,12 @@ fail; AC_CHECK_HEADER([AppKit/AppKit.h], [HAVE_NS=yes], [AC_MSG_ERROR([`--with-ns' was specified, but the include files are missing or cannot be compiled.])]) - NS_HAVE_NSINTEGER=yes AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [NSInteger i;])], ns_have_nsinteger=yes, ns_have_nsinteger=no) - if test $ns_have_nsinteger = no; then - NS_HAVE_NSINTEGER=no + if test $ns_have_nsinteger = yes; then + AC_DEFINE(NS_HAVE_NSINTEGER, 1, [Define to 1 if `NSInteger' is defined.]) fi fi AC_SUBST(TEMACS_LDFLAGS2) @@ -2683,9 +2673,6 @@ if test "${HAVE_NS}" = "yes"; then ## Extra CFLAGS applied to src/*.m files. GNU_OBJC_CFLAGS="$GNU_OBJC_CFLAGS -fgnu-runtime -Wno-import -fconstant-string-class=NSConstantString -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGSWARN -DGSDIAGNOSE" fi - if test "${NS_HAVE_NSINTEGER}" = "yes"; then - AC_DEFINE(NS_HAVE_NSINTEGER, 1, [Define to 1 if `NSInteger' is defined.]) - fi # We also have mouse menus. HAVE_MENUS=yes OTHER_FILES=ns-app @@ -2828,6 +2815,7 @@ __fpending mblen mbrlen mbsinit strsignal setitimer ualarm \ sendto recvfrom getsockopt setsockopt getsockname getpeername \ gai_strerror mkstemp getline getdelim mremap fsync sync \ difftime mempcpy mblen mbrlen posix_memalign \ +getpwent endpwent getgrent endgrent \ cfmakeraw cfsetspeed copysign __executable_start) dnl Cannot use AC_CHECK_FUNCS diff --git a/etc/NEWS b/etc/NEWS index 27b5406a15..16b9f75c50 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -27,7 +27,7 @@ so we will look at it and add it to the manual. If building with GCC, this enables compile-time checks that warn about possibly-questionable C code. On a recent GNU system there should be no warnings; on older and on non-GNU systems the generated warnings -may or may not be useful. By default, these warnings are not generated. +may be useful. * Startup Changes in Emacs 24.2 @@ -39,6 +39,9 @@ been adding them there, put them somewhere else, eg site-lisp. * Changes in Emacs 24.2 +** New functions `system-users', `system-groups' return lists of the user +name, group names known to the system (where possible). + ** If your Emacs was built from a bzr checkout, the new variable `emacs-bzr-version' contains information about which bzr revision was used. @@ -74,7 +77,12 @@ channel keys found, if any. ** The `server-auth-key' variable can be used to set a permanent shared key for Emacs Server. - + +** In Perl mode, new option `perl-indent-parens-as-block' causes non-block +closing brackets to be aligned with the line of the opening bracket. + +** FIXME something happened to ses.el, 2012-04-17. + ** Obsolete packages: *** mailpost.el diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 55e76c0b00..161d71381c 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,4 +1,4 @@ -2012-04-16 Paul Eggert +2012-04-17 Paul Eggert configure: new option --enable-gcc-warnings (Bug#11207) * Makefile.in (C_WARNINGS_SWITCH): Remove. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7ebeea0a9d..d9aadbe0f2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,7 +1,115 @@ +2012-04-17 Juanma Barranquero + + * server.el (server-ensure-safe-dir): Simplify. + +2012-04-17 Stefan Monnier + + * emacs-lisp/smie.el: Provide smarter auto-filling. + (smie-auto-fill): New function. + (smie-setup): Use it. + + * newcomment.el (comment-choose-indent): Obey comment-inline-offset. + +2012-04-17 Philipp Haselwarter (tiny change) + + * newcomment.el (comment-inline-offset): New custom var (bug#11090). + (comment-indent): Use it. + +2012-04-17 Vincent Belaïche + + * ses.el: The overall change is to add cell renaming, that is + setting fancy names for cell symbols other than name matching + "\\`[A-Z]+[0-9]+\\'" regexp . + (ses-localvars): Add ses--renamed-cell-symb-list. + (ses-create-cell-variable): New defun. + (ses-destroy-cell-variable-range): Respect ses--numrows, ses--numcols. + (ses-relocate-formula): Relocate formulas only for cells the + symbols of which are not renamed, i.e. symbols whose names do not + match regexp "\\`[A-Z]+[0-9]+\\'". + (ses-relocate-all): Relocate values only for cells the symbols of + which are not renamed. + (ses-load): Create cells variables as the (ses-cell ...) are read, + in order to check row col consistency with cell symbol name only + for cells that are not renamed. + (ses-replace-name-in-formula): New defun. + (ses-rename-cell): New defun. + +2012-04-17 Peter Oliver (tiny change) + + * progmodes/perl-mode.el (perl-indent-parens-as-block): + New option (bug#11118). + (perl-calculate-indent): Respect it. + +2012-04-17 Glenn Morris + + * dired-aux.el (dired-mark-read-string): Doc fix. + +2012-04-17 Dmitry Antipov + + * dired-aux.el (dired-mark-read-string): Offer optional completion. + (dired-do-chxxx): Complete chown, chgrp over users, groups. (Bug#7900) + +2012-04-17 Glenn Morris + + * mouse.el (mouse-drag-track): + * speedbar.el (speedbar-frame-mode): + Use auto-hscroll-mode rather than the alias automatic-hscrolling. + +2012-04-16 Leo Liu + + * progmodes/python.el: Trivial cleanup. + +2012-04-16 Glenn Morris + + * vc/vc.el (vc-string-prefix-p): + * vc/pcvs-util.el (cvs-string-prefix-p): + * textmodes/tex-mode.el (latex-string-prefix-p, tex-string-prefix-p): + * mpc.el (mpc-string-prefix-p): + Make all of these into obsolete aliases for string-prefix-p. + Update callers. + * vc/pcvs.el, vc/vc-dispatcher.el, vc/vc-dir.el: Update callers. + + * textmodes/two-column.el: Move custom options to the start. + (frame-width): Remove compat definition. + (2C-associate-buffer, 2C-dissociate): + Use with-current-buffer rather than save-excursion. + (2C-dissociate): Force a mode-line update. + (2C-autoscroll): Use ignore-errors. + + * emacs-lisp/eieio-opt.el (describe-class, describe-generic): + Autoload trivia. + + * emacs-lisp/cl-extra.el (*random-state*): + Remove unnecessary declaration. + + * calendar/cal-tex.el (cal-tex-end-document): Trivial clarification. + + * play/cookie1.el (cookie-snarf): + Give an explicit error if input file cannot be read. + + * play/yow.el (yow-file): Use expand-file-name rather than concat. + + * progmodes/perl-mode.el (c-macro-expand): + Remove unnecessary autoload (it is in loaddefs.el). + + * textmodes/picture.el (picture-desired-column) + (picture-update-desired-column): Convert comments to doc-strings. + (picture-substitute): Remove function. + (picture-mode-map): Initialize in the defvar. + + * woman.el: Remove eval-after-load for tar-mode. + * tar-mode.el (tar-mode-map): Add woman binding and menu entry. + (woman-tar-extract-file): Autoload it. + + * frame.el (automatic-hscrolling): Make this alias obsolete. + 2012-04-12 Agustín Martín Domingo * ispell.el (ispell-set-spellchecker-params): Post-process - `ispell-dictionary-alist' to use [:alpha:] if possible. + `ispell-dictionary-alist' to use [:alpha:] and utf-8 if possible. + (ispell-dictionary-base-alist): Revert to original XEmacs + friendly version for default. [:alpha:] will be added in + `ispell-set-spellchecker-params' if needed 2012-04-16 Chong Yidong @@ -1314,10 +1422,6 @@ * term/x-win.el (x-initialize-window-system): Reduce default for x-selection-timeout to 5 seconds (Bug#8869). -2012-02-24 Thierry Volpiatto - - * files.el (file-subdir-of-p): Fix typo. - 2012-02-24 Thierry Volpiatto * files.el (files-equal-p, file-subdir-of-p): New functions. diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el index 14899431e2..0ae2b38eaf 100644 --- a/lisp/calendar/cal-tex.el +++ b/lisp/calendar/cal-tex.el @@ -1,6 +1,6 @@ ;;; cal-tex.el --- calendar functions for printing calendars with LaTeX -;; Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc. +;; Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc. ;; Author: Steve Fisk ;; Edward M. Reingold @@ -1588,8 +1588,7 @@ 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 + (when (re-search-backward "[^[:ascii:]]" nil 'move) (goto-char (point-min)) (when (search-forward "documentclass" nil t) (forward-line 1) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 0795b0175a..8a499c4746 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -245,7 +245,11 @@ List has a form of (file-name full-file-name (attribute-list))." " (default now): " ": "))) (new-attribute (dired-mark-read-string prompt nil op-symbol - arg files default)) + arg files default + (cond ((eq op-symbol 'chown) + (system-users)) + ((eq op-symbol 'chgrp) + (system-groups))))) (operation (concat program " " new-attribute)) failures) (setq failures @@ -385,7 +389,7 @@ Uses the shell command coming from variables `lpr-command' and (dired-run-shell-command (dired-shell-stuff-it command file-list nil)))) (defun dired-mark-read-string (prompt initial op-symbol arg files - &optional default-value) + &optional default-value collection) "Read args for a Dired marked-files command, prompting with PROMPT. Return the user input (a string). @@ -397,11 +401,14 @@ FILES should be a list of file names. DEFAULT-VALUE, if non-nil, should be a \"standard\" value or list of such values, available via history commands. Note that if the user enters empty input, this function returns the empty string, -not DEFAULT-VALUE." +not DEFAULT-VALUE. + +Optional argument COLLECTION is a collection of possible completions, +suitable for use by `completing-read'." (dired-mark-pop-up nil op-symbol files - 'read-from-minibuffer + 'completing-read (format prompt (dired-mark-prompt arg files)) - initial nil nil nil default-value)) + collection nil nil initial nil default-value nil)) ;;; Cleaning a directory: flagging some backups for deletion. diff --git a/lisp/dired.el b/lisp/dired.el index d322752e15..77fe9cb761 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -3736,7 +3736,7 @@ Ask means pop up a menu for the user to select one of copy, move or link." ;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command ;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown ;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff -;;;;;; dired-diff) "dired-aux" "dired-aux.el" "58d623eb8e68e472e6164a1bcae83360") +;;;;;; dired-diff) "dired-aux" "dired-aux.el" "de7e4c64718c8ba8438a6397a460bf23") ;;; Generated autoloads from dired-aux.el (autoload 'dired-diff "dired-aux" "\ diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index 9ac5ce7d2f..9a3d8cf705 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -1,6 +1,6 @@ ;;; cl-extra.el --- Common Lisp features, part 2 -;; Copyright (C) 1993, 2000-2012 Free Software Foundation, Inc. +;; Copyright (C) 1993, 2000-2012 Free Software Foundation, Inc. ;; Author: Dave Gillespie ;; Keywords: extensions @@ -430,7 +430,6 @@ With two arguments, return rounding and remainder of their quotient." ;; Random numbers. -(defvar *random-state*) ;;;###autoload (defun random* (lim &optional state) "Return a random nonnegative number less than LIM, an integer or float. diff --git a/lisp/emacs-lisp/cl-loaddefs.el b/lisp/emacs-lisp/cl-loaddefs.el index 5bb86628bb..9e0099bb64 100644 --- a/lisp/emacs-lisp/cl-loaddefs.el +++ b/lisp/emacs-lisp/cl-loaddefs.el @@ -10,7 +10,7 @@ ;;;;;; ceiling* floor* isqrt lcm gcd cl-progv-before cl-set-frame-visible-p ;;;;;; cl-map-overlays cl-map-intervals cl-map-keymap-recursively ;;;;;; notevery notany every some mapcon mapcan mapl maplist map -;;;;;; cl-mapcar-many equalp coerce) "cl-extra" "cl-extra.el" "c172dda6770ce18b556561481bfefbb2") +;;;;;; cl-mapcar-many equalp coerce) "cl-extra" "cl-extra.el" "5a8a7f7ec2dc453113b8cbda577f2acb") ;;; Generated autoloads from cl-extra.el (autoload 'coerce "cl-extra" "\ diff --git a/lisp/emacs-lisp/eieio-opt.el b/lisp/emacs-lisp/eieio-opt.el index 10816aaa43..a899839f68 100644 --- a/lisp/emacs-lisp/eieio-opt.el +++ b/lisp/emacs-lisp/eieio-opt.el @@ -72,8 +72,7 @@ Argument CH-PREFIX is another character prefix to display." ;;; CLASS COMPLETION / DOCUMENTATION -;;;###autoload -(defalias 'describe-class 'eieio-describe-class) +;;;###autoload(defalias 'describe-class 'eieio-describe-class) ;;;###autoload (defun eieio-describe-class (class &optional headerfcn) @@ -305,8 +304,7 @@ are not abstract." ;;; METHOD COMPLETION / DOC (defalias 'describe-method 'eieio-describe-generic) -;;;###autoload -(defalias 'describe-generic 'eieio-describe-generic) +;;;###autoload(defalias 'describe-generic 'eieio-describe-generic) (defalias 'eieio-describe-method 'eieio-describe-generic) ;;;###autoload diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index 257d0528cb..a7916354c9 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2008, 2010-2012 Free Software Foundation, Inc. ;; Author: Lennart Borgman (lennart O borgman A gmail O com) -;; Author: Christian Ohler +;; Christian Ohler ;; This file is part of GNU Emacs. diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el index 2a12f03e51..5382e601e6 100644 --- a/lisp/emacs-lisp/smie.el +++ b/lisp/emacs-lisp/smie.el @@ -1602,6 +1602,38 @@ to which that point should be aligned, if we were to reindent it.") (save-excursion (indent-line-to indent)) (indent-line-to indent))))) +(defun smie-auto-fill () + (let ((fc (current-fill-column)) + (try-again nil)) + (while (and fc (> (current-column) fc)) + (cond + ((not (or (nth 8 (save-excursion + (syntax-ppss (line-beginning-position)))) + (nth 8 (syntax-ppss)))) + (save-excursion + (beginning-of-line) + (smie-indent-forward-token) + (let ((bsf (point)) + (gain 0) + curcol) + (while (<= (setq curcol (current-column)) fc) + ;; FIXME? `smie-indent-calculate' can (and often will) + ;; return a result that actually depends on the presence/absence + ;; of a newline, so the gain computed here may not be accurate, + ;; but in practice it seems to works well enough. + (let* ((newcol (smie-indent-calculate)) + (newgain (- curcol newcol))) + (when (> newgain gain) + (setq gain newgain) + (setq bsf (point)))) + (smie-indent-forward-token)) + (when (> gain 0) + (setq try-again) + (goto-char bsf) + (newline-and-indent))))) + (t (do-auto-fill)))))) + + (defun smie-setup (grammar rules-function &rest keywords) "Setup SMIE navigation and indentation. GRAMMAR is a grammar table generated by `smie-prec2->grammar'. @@ -1612,6 +1644,7 @@ KEYWORDS are additional arguments, which can use the following keywords: (set (make-local-variable 'smie-rules-function) rules-function) (set (make-local-variable 'smie-grammar) grammar) (set (make-local-variable 'indent-line-function) 'smie-indent-line) + (set (make-local-variable 'normal-auto-fill-function) 'smie-auto-fill) (set (make-local-variable 'forward-sexp-function) 'smie-forward-sexp-command) (while keywords diff --git a/lisp/frame.el b/lisp/frame.el index 79e1243c7a..1ee9d966ef 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -1651,7 +1651,8 @@ terminals, cursor blinking is controlled by the terminal." ;; Misc. -(defvaralias 'automatic-hscrolling 'auto-hscroll-mode) +;; Only marked as obsolete in 24.2. +(define-obsolete-variable-alias 'automatic-hscrolling 'auto-hscroll-mode "22.1") (make-variable-buffer-local 'show-trailing-whitespace) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 23e800e0f3..52f140d919 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,7 @@ +2012-04-16 Glenn Morris + + * nndraft.el (nndraft-request-list): Fix declaration. + 2012-04-14 Lars Magne Ingebrigtsen * gnus-msg.el (gnus-inews-insert-gcc): Don't do the alist stuff when we diff --git a/lisp/gnus/nndraft.el b/lisp/gnus/nndraft.el index 1800d0c02d..da50720ebb 100644 --- a/lisp/gnus/nndraft.el +++ b/lisp/gnus/nndraft.el @@ -37,7 +37,8 @@ (require 'mm-util) (eval-when-compile (require 'cl)) -(declare-function nndraft-request-list "nnmh" (&rest args)) +;; The nnoo-import at the end, I think. +(declare-function nndraft-request-list "nndraft" (&rest args) t) (nnoo-declare nndraft nnmh) diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el index 4e76e5cdb6..f35560841e 100644 --- a/lisp/mail/feedmail.el +++ b/lisp/mail/feedmail.el @@ -1586,7 +1586,7 @@ messages to make sure it works as expected." ;; feedmail-buffer-to-binmail, feedmail-buffer-to-sendmail, and -;; feedmail-buffer-to-smptmail are the only things provided for values +;; feedmail-buffer-to-smtpmail are the only things provided for values ;; for the variable feedmail-buffer-eating-function. It's pretty easy ;; to write your own, though. (defun feedmail-buffer-to-binmail (prepped errors-to addr-listoid) diff --git a/lisp/mouse.el b/lisp/mouse.el index 2e11948379..3344bbec2c 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -1,6 +1,6 @@ ;;; mouse.el --- window system-independent mouse support -;; Copyright (C) 1993-1995, 1999-2012 Free Software Foundation, Inc. +;; Copyright (C) 1993-1995, 1999-2012 Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: hardware, mouse @@ -805,8 +805,8 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by (= click-count 1))) ;; Suppress automatic hscrolling, because that is a nuisance ;; when setting point near the right fringe (but see below). - (automatic-hscrolling-saved automatic-hscrolling) - (automatic-hscrolling nil) + (auto-hscroll-mode-saved auto-hscroll-mode) + (auto-hscroll-mode nil) event end end-point) (setq mouse-selection-click-count click-count) @@ -838,7 +838,7 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by ;; Automatic hscrolling did not occur during the call to ;; `read-event'; but if the user subsequently drags the ;; mouse, go ahead and hscroll. - (let ((automatic-hscrolling automatic-hscrolling-saved)) + (let ((auto-hscroll-mode auto-hscroll-mode-saved)) (redisplay)) (setq end (event-end event) end-point (posn-point end)) diff --git a/lisp/mpc.el b/lisp/mpc.el index 614f2bd680..d2203a4dea 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -1,6 +1,6 @@ ;;; mpc.el --- A client for the Music Player Daemon -*- coding: utf-8; lexical-binding: t -*- -;; Copyright (C) 2006-2012 Free Software Foundation, Inc. +;; Copyright (C) 2006-2012 Free Software Foundation, Inc. ;; Author: Stefan Monnier ;; Keywords: multimedia @@ -184,10 +184,7 @@ numerically rather than lexicographically." (abs res)) res)))))))) -(defun mpc-string-prefix-p (str1 str2) - ;; FIXME: copied from pcvs-util.el. - "Tell whether STR1 is a prefix of STR2." - (eq t (compare-strings str2 nil (length str1) str1 nil nil))) +(define-obsolete-function-alias 'mpc-string-prefix-p 'string-prefix-p "24.2") ;; This can speed up mpc--song-search significantly. The table may grow ;; very large, tho. It's only bounded by the fact that it gets flushed @@ -1690,7 +1687,7 @@ Return non-nil if a selection was deactivated." (process-put (mpc-proc) prop (delq nil (mapcar (lambda (x) - (if (mpc-string-prefix-p name x) + (if (string-prefix-p name x) nil x)) new))))) (mpc-tagbrowser-refresh))) diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 37a76e0309..0862427c3b 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -269,6 +269,19 @@ makes the comment easier to read. Default is 1. nil means 0." :type '(choice string integer (const nil)) :group 'comment) +(defcustom comment-inline-offset 1 + "Inline comments have to be preceded by at least this many spaces. +This is useful when style-conventions require a certain minimal offset. +Python's PEP8 for example recommends two spaces, so you could do: + +\(add-hook 'python-mode-hook + (lambda () (set (make-local-variable 'comment-inline-offset) 2))) + +See `comment-padding' for whole-line comments." + :version "24.2" + :type 'integer + :group 'comment) + ;;;###autoload (defcustom comment-multi-line nil "Non-nil means `comment-indent-new-line' continues comments. @@ -587,7 +600,7 @@ Point is expected to be at the start of the comment." (save-excursion (end-of-line) (current-column))))) (other nil) (min (save-excursion (skip-chars-backward " \t") - (if (bolp) 0 (1+ (current-column)))))) + (if (bolp) 0 (+ comment-inline-offset (current-column)))))) ;; Fix up the range. (if (< max min) (setq max min)) ;; Don't move past the fill column. @@ -687,7 +700,8 @@ If CONTINUE is non-nil, use the `comment-continue' markers if any." (save-excursion (skip-chars-backward " \t") (unless (bolp) - (setq indent (max indent (1+ (current-column)))))) + (setq indent (max indent + (+ (current-column) comment-inline-offset))))) ;; If that's different from comment's current position, change it. (unless (= (current-column) indent) (delete-region (point) (progn (skip-chars-backward " \t") (point))) diff --git a/lisp/play/cookie1.el b/lisp/play/cookie1.el index 06bd962d92..cbf29a26a7 100644 --- a/lisp/play/cookie1.el +++ b/lisp/play/cookie1.el @@ -96,6 +96,8 @@ of load, ENDMSG at the end." "Reads in the PHRASE-FILE, returns it as a vector of strings. Emit STARTMSG and ENDMSG before and after. Caches the result; second and subsequent calls on the same file won't go to disk." + (or (file-readable-p phrase-file) + (error "Cannot read file `%s'" phrase-file)) (let ((sym (intern-soft phrase-file cookie-cache))) (and sym (not (equal (symbol-function sym) (nth 5 (file-attributes phrase-file)))) diff --git a/lisp/play/yow.el b/lisp/play/yow.el index fa32fdf827..cb02a839cd 100644 --- a/lisp/play/yow.el +++ b/lisp/play/yow.el @@ -1,6 +1,6 @@ ;;; yow.el --- quote random zippyisms -;; Copyright (C) 1993-1995, 2000-2012 Free Software Foundation, Inc. +;; Copyright (C) 1993-1995, 2000-2012 Free Software Foundation, Inc. ;; Maintainer: FSF ;; Author: Richard Mlynarik @@ -24,10 +24,6 @@ ;;; Commentary: ;; Important pinheadery for GNU Emacs. -;; -;; See cookie1.el for implementation. Note --- the `n' argument of yow -;; from the 18.xx implementation is no longer; we only support *random* -;; random access now. ;;; Code: @@ -38,7 +34,7 @@ :prefix "yow-" :group 'games) -(defcustom yow-file (concat data-directory "yow.lines") +(defcustom yow-file (expand-file-name "yow.lines" data-directory) "File containing pertinent pinhead phrases." :type 'file :group 'yow) diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index aab5f8f65a..9df9943cc0 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -1,6 +1,6 @@ ;;; perl-mode.el --- Perl code editing commands for GNU Emacs -;; Copyright (C) 1990, 1994, 2001-2012 Free Software Foundation, Inc. +;; Copyright (C) 1990, 1994, 2001-2012 Free Software Foundation, Inc. ;; Author: William F. Mann ;; Maintainer: FSF @@ -133,11 +133,6 @@ map) "Keymap used in Perl mode.") -(autoload 'c-macro-expand "cmacexp" - "Display the result of expanding all C macros occurring in the region. -The expansion is entirely correct because it uses the C preprocessor." - t) - (defvar perl-mode-syntax-table (let ((st (make-syntax-table (standard-syntax-table)))) (modify-syntax-entry ?\n ">" st) @@ -511,6 +506,14 @@ If nil, continued arguments are aligned with the first argument." :type '(choice integer (const nil)) :group 'perl) +(defcustom perl-indent-parens-as-block nil + "Non-nil means that non-block ()-, {}- and []-groups are indented as blocks. +The closing bracket is aligned with the line of the opening bracket, +not the contents of the brackets." + :version "24.2" + :type 'boolean + :group 'perl) + (defcustom perl-tab-always-indent tab-always-indent "Non-nil means TAB in Perl mode always indents the current line. Otherwise it inserts a tab character if you type it past the first @@ -853,7 +856,8 @@ Optional argument PARSE-START should be the position of `beginning-of-defun'." (cond ((nth 3 state) 'noindent) ; In a quoted string? ((null containing-sexp) ; Line is at top level. (skip-chars-forward " \t\f") - (if (= (following-char) ?{) + (if (memq (following-char) + (if perl-indent-parens-as-block '(?\{ ?\( ?\[) '(?\{))) 0 ; move to beginning of line if it starts a function body ;; indent a little if this is a continuation line (perl-backward-to-noncomment) @@ -897,7 +901,9 @@ Optional argument PARSE-START should be the position of `beginning-of-defun'." 0 perl-continued-statement-offset) (current-column) (if (save-excursion (goto-char indent-point) - (looking-at "[ \t]*{")) + (looking-at + (if perl-indent-parens-as-block + "[ \t]*[{(\[]" "[ \t]*{"))) perl-continued-brace-offset 0))) ;; This line starts a new statement. ;; Position at last unclosed open. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 09b8999362..6f8758ebec 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -69,11 +69,7 @@ (require 'comint) (require 'ansi-color) -(eval-when-compile - (require 'compile) - (require 'hippie-exp)) - -(autoload 'comint-mode "comint") +(eval-when-compile (require 'compile)) (defgroup python nil "Silly walks in the Python language." @@ -1488,8 +1484,6 @@ Don't save anything for STR matching `inferior-python-filter-regexp'." res) (t (concat res s))))) -(autoload 'comint-check-proc "comint") - (defvar python-version-checked nil) (defun python-check-version (cmd) "Check that CMD runs a suitable version of Python." @@ -1684,8 +1678,6 @@ value to determine defaults." "Caches (directory . file) pair used in the last `python-load-file' command. Used for determining the default in the next one.") -(autoload 'comint-get-source "comint") - (defun python-load-file (file-name) "Load a Python file FILE-NAME into the inferior Python process. If the file has extension `.py' import or reload it as a module. diff --git a/lisp/server.el b/lisp/server.el index 058bc55d87..c82a639ead 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -520,31 +520,27 @@ Creates the directory if necessary and makes sure: ;; Check that it's safe for use. (let* ((uid (nth 2 attrs)) (w32 (eq system-type 'windows-nt)) - (safe (catch :safe - (unless (eq t (car attrs)) ; is a dir? - (throw :safe nil)) - (when (and w32 (zerop uid)) ; on FAT32? - (display-warning - 'server - (format "Using `%s' to store Emacs-server authentication files. + (safe (cond + ((not (eq t (car attrs))) nil) ; is a dir? + ((and w32 (zerop uid)) ; on FAT32? + (display-warning + 'server + (format "Using `%s' to store Emacs-server authentication files. Directories on FAT32 filesystems are NOT secure against tampering. See variable `server-auth-dir' for details." - (file-name-as-directory dir)) - :warning) - (throw :safe t)) - (unless (or (= uid (user-uid)) ; is the dir ours? - (and w32 - ;; Files created on Windows by - ;; Administrator (RID=500) have - ;; the Administrators (RID=544) - ;; group recorded as the owner. - (= uid 544) (= (user-uid) 500))) - (throw :safe nil)) - (when w32 ; on NTFS? - (throw :safe t)) - (unless (zerop (logand ?\077 (file-modes dir))) - (throw :safe nil)) - t))) + (file-name-as-directory dir)) + :warning) + t) + ((and (/= uid (user-uid)) ; is the dir ours? + (or (not w32) + ;; Files created on Windows by Administrator + ;; (RID=500) have the Administrators (RID=544) + ;; group recorded as the owner. + (/= uid 544) (/= (user-uid) 500))) + nil) + (w32 t) ; on NTFS? + (t ; else, check permissions + (zerop (logand ?\077 (file-modes dir))))))) (unless safe (error "The directory `%s' is unsafe" dir))))) diff --git a/lisp/ses.el b/lisp/ses.el index 0638fc344c..da18046c95 100644 --- a/lisp/ses.el +++ b/lisp/ses.el @@ -282,6 +282,9 @@ default printer and then modify its output.") ses--numcols ses--numrows ses--symbolic-formulas ses--data-marker ses--params-marker (ses--Dijkstra-attempt-nb . 0) ses--Dijkstra-weight-bound + ;; This list is useful to speed-up clean-up of symbols when + ;; an area containing renamed cell is deleted. + ses--renamed-cell-symb-list ;; Global variables that we override mode-line-process next-line-add-newlines transient-mark-mode) "Buffer-local variables used by SES.") @@ -674,6 +677,17 @@ for this spreadsheet." (put sym 'ses-cell (cons xrow xcol)) (make-local-variable sym))))) +(defun ses-create-cell-variable (sym row col) + "Create a buffer-local variable `SYM' for cell at position (ROW, COL). + +SYM is the symbol for that variable, ROW and COL are integers for +row and column of the cell, with numbering starting from 0. + +Return nil in case of failure." + (unless (local-variable-p sym) + (make-local-variable sym) + (put sym 'ses-cell (cons row col)))) + ;; We do not delete the ses-cell properties for the cell-variables, in ;; case a formula that refers to this cell is in the kill-ring and is ;; later pasted back in. @@ -682,7 +696,10 @@ for this spreadsheet." (let (sym) (dotimes (row (1+ (- maxrow minrow))) (dotimes (col (1+ (- maxcol mincol))) - (setq sym (ses-create-cell-symbol (+ row minrow) (+ col mincol))) + (let ((xrow (+ row minrow)) (xcol (+ col mincol))) + (setq sym (if (and (< xrow ses--numrows) (< xcol ses--numcols)) + (ses-cell-symbol xrow xcol) + (ses-create-cell-symbol xrow xcol)))) (if (boundp sym) (push `(apply ses-set-with-undo ,sym ,(symbol-value sym)) buffer-undo-list)) @@ -1400,7 +1417,8 @@ removed. Example: Sets `ses-relocate-return' to 'delete if cell-references were removed." (let (rowcol result) (if (or (atom formula) (eq (car formula) 'quote)) - (if (setq rowcol (ses-sym-rowcol formula)) + (if (and (setq rowcol (ses-sym-rowcol formula)) + (string-match "\\`[A-Z]+[0-9]+\\'" (symbol-name formula))) (ses-relocate-symbol formula rowcol startrow startcol rowincr colincr) formula) ; Pass through as-is. @@ -1508,14 +1526,15 @@ if the range was altered." the rectangle (MINROW,MINCOL)..(NUMROWS,NUMCOLS) by adding ROWINCR and COLINCR to each symbol." (let (reform) - (let (mycell newval) + (let (mycell newval xrow) (dotimes-with-progress-reporter (row ses--numrows) "Relocating formulas..." (dotimes (col ses--numcols) (setq ses-relocate-return nil mycell (ses-get-cell row col) newval (ses-relocate-formula (ses-cell-formula mycell) - minrow mincol rowincr colincr)) + minrow mincol rowincr colincr) + xrow (- row rowincr)) (ses-set-cell row col 'formula newval) (if (eq ses-relocate-return 'range) ;; This cell contains a (ses-range X Y) where a cell has been @@ -1531,8 +1550,22 @@ to each symbol." minrow mincol rowincr colincr)) (ses-set-cell row col 'references newval) (and (>= row minrow) (>= col mincol) - (ses-set-cell row col 'symbol - (ses-create-cell-symbol row col)))))) + (let ((sym (ses-cell-symbol row col)) + (xcol (- col colincr))) + (if (and + sym + (>= xrow 0) + (>= xcol 0) + (null (eq sym + (ses-create-cell-symbol xrow xcol)))) + ;; This is a renamed cell, do not update the cell + ;; name, but just update the coordinate property. + (put sym 'ses-cell (cons row col)) + (ses-set-cell row col 'symbol + (setq sym (ses-create-cell-symbol row col))) + (unless (and (boundp sym) (local-variable-p sym)) + (set (make-local-variable sym) nil) + (put sym 'ses-cell (cons row col)))))) ))) ;; Relocate the cell values. (let (oldval myrow mycol xrow xcol) (cond @@ -1545,11 +1578,17 @@ to each symbol." (setq mycol (+ col mincol) xrow (- myrow rowincr) xcol (- mycol colincr)) - (if (and (< xrow ses--numrows) (< xcol ses--numcols)) - (setq oldval (ses-cell-value xrow xcol)) - ;; Cell is off the end of the array. - (setq oldval (symbol-value (ses-create-cell-symbol xrow xcol)))) - (ses-set-cell myrow mycol 'value oldval)))) + (let ((sym (ses-cell-symbol myrow mycol)) + (xsym (ses-create-cell-symbol xrow xcol))) + ;; Make the value relocation only when if the cell is not + ;; a renamed cell. Otherwise this is not needed. + (and (eq sym xsym) + (ses-set-cell myrow mycol 'value + (if (and (< xrow ses--numrows) (< xcol ses--numcols)) + (ses-cell-value xrow xcol) + ;;Cell is off the end of the array + (symbol-value xsym)))))))) + ((and (wholenump rowincr) (wholenump colincr)) ;; Insertion of rows and/or columns. Run the loop backwards. (let ((disty (1- ses--numrows)) @@ -1659,7 +1698,6 @@ Does not execute cell formulas or print functions." (message "Upgrading from SES-1 file format"))) (or (= ses--file-format 2) (error "This file needs a newer version of the SES library code")) - (ses-create-cell-variable-range 0 (1- ses--numrows) 0 (1- ses--numcols)) ;; Initialize cell array. (setq ses--cells (make-vector ses--numrows nil)) (dotimes (row ses--numrows) @@ -1679,11 +1717,10 @@ Does not execute cell formulas or print functions." (dotimes (row ses--numrows) (dotimes (col ses--numcols) (let* ((x (read (current-buffer))) - (rowcol (ses-sym-rowcol (car-safe (cdr-safe x))))) + (sym (car-safe (cdr-safe x)))) (or (and (looking-at "\n") (eq (car-safe x) 'ses-cell) - (eq row (car rowcol)) - (eq col (cdr rowcol))) + (ses-create-cell-variable sym row col)) (error "Cell-def error")) (eval x))) (or (looking-at "\n\n") @@ -3140,6 +3177,63 @@ highlighted range in the spreadsheet." (mouse-set-point event) (ses-insert-ses-range)) +(defun ses-replace-name-in-formula (formula old-name new-name) + (let ((new-formula formula)) + (unless (and (consp formula) + (eq (car-safe formula) 'quote)) + (while formula + (let ((elt (car-safe formula))) + (cond + ((consp elt) + (setcar formula (ses-replace-name-in-formula elt old-name new-name))) + ((and (symbolp elt) + (eq (car-safe formula) old-name)) + (setcar formula new-name)))) + (setq formula (cdr formula)))) + new-formula)) + +(defun ses-rename-cell (new-name) + "Rename current cell." + (interactive "*SEnter new name: ") + (ses-check-curcell) + (or + (and (local-variable-p new-name) + (ses-sym-rowcol new-name) + ;; this test is needed because ses-cell property of deleted cells + ;; is not deleted in case of subsequent undo + (memq new-name ses--renamed-cell-symb-list) + (error "Already a cell name")) + (and (boundp new-name) + (null (yes-or-no-p (format "`%S' is already bound outside this buffer, continue? " + new-name))) + (error "Already a bound cell name"))) + (let* ((rowcol (ses-sym-rowcol ses--curcell)) + (cell (ses-get-cell (car rowcol) (cdr rowcol)))) + (put new-name 'ses-cell rowcol) + (dolist (reference (ses-cell-references (car rowcol) (cdr rowcol))) + (let* ((rowcol (ses-sym-rowcol reference)) + (cell (ses-get-cell (car rowcol) (cdr rowcol)))) + (ses-cell-set-formula (car rowcol) + (cdr rowcol) + (ses-replace-name-in-formula + (ses-cell-formula cell) + ses--curcell + new-name)))) + (push new-name ses--renamed-cell-symb-list) + (set new-name (symbol-value ses--curcell)) + (aset cell 0 new-name) + (put ses--curcell 'ses-cell nil) + (makunbound ses--curcell) + (setq ses--curcell new-name) + (let* ((pos (point)) + (inhibit-read-only t) + (col (current-column)) + (end (save-excursion + (move-to-column (1+ col)) + (if (eolp) + (+ pos (ses-col-width col) 1) + (point))))) + (put-text-property pos end 'intangible new-name))) ) ;;---------------------------------------------------------------------------- ;; Checking formulas for safety diff --git a/lisp/speedbar.el b/lisp/speedbar.el index bb1debb455..9065d9ed13 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -1,6 +1,6 @@ ;;; speedbar --- quick access to files and tags in a frame -;; Copyright (C) 1996-2012 Free Software Foundation, Inc. +;; Copyright (C) 1996-2012 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Keywords: file, tags, tools @@ -1022,7 +1022,7 @@ supported at a time. (set (make-local-variable 'dframe-delete-frame-function) 'speedbar-handle-delete-frame) ;; hscroll - (set (make-local-variable 'automatic-hscrolling) nil) ; Emacs 21 + (set (make-local-variable 'auto-hscroll-mode) nil) ;; reset the selection variable (setq speedbar-last-selected-file nil)) diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index 3eb2be1569..7c95f47e0f 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -549,6 +549,7 @@ MODE should be an integer which is a file mode value." (define-key map "R" 'tar-rename-entry) (define-key map "u" 'tar-unflag) (define-key map "v" 'tar-view) + (define-key map "w" 'woman-tar-extract-file) (define-key map "x" 'tar-expunge) (define-key map "\177" 'tar-unflag-backwards) (define-key map "E" 'tar-extract-other-window) @@ -566,6 +567,8 @@ MODE should be an integer which is a file mode value." (define-key map [menu-bar immediate] (cons "Immediate" (make-sparse-keymap "Immediate"))) + (define-key map [menu-bar immediate woman] + '("Read Man Page (WoMan)" . woman-tar-extract-file)) (define-key map [menu-bar immediate view] '("View This File" . tar-view)) (define-key map [menu-bar immediate display] @@ -677,6 +680,8 @@ See also: variables `tar-update-datestamp' and `tar-anal-blocksize'. (fundamental-mode) (signal (car err) (cdr err))))) +(autoload 'woman-tar-extract-file "woman" + "In tar mode, run the WoMan man-page browser on this file." t) (define-minor-mode tar-subfile-mode "Minor mode for editing an element of a tar-file. diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index cfb1a2b360..5382269469 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -574,12 +574,12 @@ re-start Emacs." (defvar ispell-dictionary-base-alist - '((nil + '((nil ; default ;; The default dictionary. It may be English.aff, or any other ;; dictionary depending on locale and such things. We should probably ;; ask ispell what dictionary it's using, but until we do that, let's - ;; just use an approximate regexp. - "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-B") nil iso-8859-1) + ;; just use a minimal regexp. [:alpha:] will later be set if possible. + "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1) ("american" ; Yankee English "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1) ("brasileiro" ; Brazilian mode diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el index 9e8cbb216d..3e2ab7892d 100644 --- a/lisp/textmodes/picture.el +++ b/lisp/textmodes/picture.el @@ -63,15 +63,17 @@ ;; Picture Movement Commands -;; When a cursor is on a wide-column character (e.g. Chinese, -;; Japanese, Korean), this variable tells the desired current column -;; which may be different from (current-column). -(defvar picture-desired-column 0) - -;; If the value of picture-desired-column is far from the current -;; column, or if the arg ADJUST-TO-CURRENT is non-nil, set it to the -;; current column. Return the current column. +(defvar picture-desired-column 0 + "Desired current column for Picture mode. +When a cursor is on a wide-column character (e.g. Chinese, +Japanese, Korean), this may may be different from `current-column'.") + + (defun picture-update-desired-column (adjust-to-current) + "Maybe update `picture-desired-column'. +If the value of `picture-desired-column' is more than one column +from `current-column', or if the argument ADJUST-TO-CURRENT is +non-nil, set it to the current column. Return `current-column'." (let ((current-column (current-column))) (if (or adjust-to-current (< picture-desired-column (1- current-column)) @@ -606,64 +608,61 @@ Leaves the region surrounding the rectangle." (defalias 'picture-delete-char 'delete-char) -(defvar picture-mode-map nil) - -(defun picture-substitute (oldfun newfun) - (define-key picture-mode-map (vector 'remap oldfun) newfun)) - -(if (not picture-mode-map) - (progn - (setq picture-mode-map (make-keymap)) - (picture-substitute 'self-insert-command 'picture-self-insert) - (picture-substitute 'completion-separator-self-insert-command - 'picture-self-insert) - (picture-substitute 'completion-separator-self-insert-autofilling - 'picture-self-insert) - (picture-substitute 'forward-char 'picture-forward-column) - (picture-substitute 'backward-char 'picture-backward-column) - (picture-substitute 'delete-char 'picture-clear-column) - ;; There are two possibilities for what is normally on DEL. - (picture-substitute 'backward-delete-char-untabify 'picture-backward-clear-column) - (picture-substitute 'delete-backward-char 'picture-backward-clear-column) - (picture-substitute 'kill-line 'picture-clear-line) - (picture-substitute 'open-line 'picture-open-line) - (picture-substitute 'newline 'picture-newline) - (picture-substitute 'newline-and-indent 'picture-duplicate-line) - (picture-substitute 'next-line 'picture-move-down) - (picture-substitute 'previous-line 'picture-move-up) - (picture-substitute 'move-beginning-of-line 'picture-beginning-of-line) - (picture-substitute 'move-end-of-line 'picture-end-of-line) - (picture-substitute 'mouse-set-point 'picture-mouse-set-point) - - (define-key picture-mode-map "\C-c\C-d" 'picture-delete-char) - (define-key picture-mode-map "\e\t" 'picture-toggle-tab-state) - (define-key picture-mode-map "\t" 'picture-tab) - (define-key picture-mode-map "\e\t" 'picture-tab-search) - (define-key picture-mode-map "\C-c\t" 'picture-set-tab-stops) - (define-key picture-mode-map "\C-c\C-k" 'picture-clear-rectangle) - (define-key picture-mode-map "\C-c\C-w" 'picture-clear-rectangle-to-register) - (define-key picture-mode-map "\C-c\C-y" 'picture-yank-rectangle) - (define-key picture-mode-map "\C-c\C-x" 'picture-yank-rectangle-from-register) - (define-key picture-mode-map "\C-c\C-r" 'picture-draw-rectangle) - (define-key picture-mode-map "\C-c\C-c" 'picture-mode-exit) - (define-key picture-mode-map "\C-c\C-f" 'picture-motion) - (define-key picture-mode-map "\C-c\C-b" 'picture-motion-reverse) - (define-key picture-mode-map "\C-c<" 'picture-movement-left) - (define-key picture-mode-map "\C-c>" 'picture-movement-right) - (define-key picture-mode-map "\C-c^" 'picture-movement-up) - (define-key picture-mode-map "\C-c." 'picture-movement-down) - (define-key picture-mode-map "\C-c`" 'picture-movement-nw) - (define-key picture-mode-map "\C-c'" 'picture-movement-ne) - (define-key picture-mode-map "\C-c/" 'picture-movement-sw) - (define-key picture-mode-map "\C-c\\" 'picture-movement-se) - (define-key picture-mode-map [(control ?c) left] 'picture-movement-left) - (define-key picture-mode-map [(control ?c) right] 'picture-movement-right) - (define-key picture-mode-map [(control ?c) up] 'picture-movement-up) - (define-key picture-mode-map [(control ?c) down] 'picture-movement-down) - (define-key picture-mode-map [(control ?c) home] 'picture-movement-nw) - (define-key picture-mode-map [(control ?c) prior] 'picture-movement-ne) - (define-key picture-mode-map [(control ?c) end] 'picture-movement-sw) - (define-key picture-mode-map [(control ?c) next] 'picture-movement-se))) +(defvar picture-mode-map + (let ((map (make-keymap))) + (define-key map [remap self-insert-command] 'picture-self-insert) + (define-key map [remap self-insert-command] 'picture-self-insert) + (define-key map [remap completion-separator-self-insert-command] + 'picture-self-insert) + (define-key map [remap completion-separator-self-insert-autofilling] + 'picture-self-insert) + (define-key map [remap forward-char] 'picture-forward-column) + (define-key map [remap backward-char] 'picture-backward-column) + (define-key map [remap delete-char] 'picture-clear-column) + ;; There are two possibilities for what is normally on DEL. + (define-key map [remap backward-delete-char-untabify] + 'picture-backward-clear-column) + (define-key map [remap delete-backward-char] 'picture-backward-clear-column) + (define-key map [remap kill-line] 'picture-clear-line) + (define-key map [remap open-line] 'picture-open-line) + (define-key map [remap newline] 'picture-newline) + (define-key map [remap newline-and-indent] 'picture-duplicate-line) + (define-key map [remap next-line] 'picture-move-down) + (define-key map [remap previous-line] 'picture-move-up) + (define-key map [remap move-beginning-of-line] 'picture-beginning-of-line) + (define-key map [remap move-end-of-line] 'picture-end-of-line) + (define-key map [remap mouse-set-point] 'picture-mouse-set-point) + (define-key map "\C-c\C-d" 'picture-delete-char) + (define-key map "\e\t" 'picture-toggle-tab-state) + (define-key map "\t" 'picture-tab) + (define-key map "\e\t" 'picture-tab-search) + (define-key map "\C-c\t" 'picture-set-tab-stops) + (define-key map "\C-c\C-k" 'picture-clear-rectangle) + (define-key map "\C-c\C-w" 'picture-clear-rectangle-to-register) + (define-key map "\C-c\C-y" 'picture-yank-rectangle) + (define-key map "\C-c\C-x" 'picture-yank-rectangle-from-register) + (define-key map "\C-c\C-r" 'picture-draw-rectangle) + (define-key map "\C-c\C-c" 'picture-mode-exit) + (define-key map "\C-c\C-f" 'picture-motion) + (define-key map "\C-c\C-b" 'picture-motion-reverse) + (define-key map "\C-c<" 'picture-movement-left) + (define-key map "\C-c>" 'picture-movement-right) + (define-key map "\C-c^" 'picture-movement-up) + (define-key map "\C-c." 'picture-movement-down) + (define-key map "\C-c`" 'picture-movement-nw) + (define-key map "\C-c'" 'picture-movement-ne) + (define-key map "\C-c/" 'picture-movement-sw) + (define-key map "\C-c\\" 'picture-movement-se) + (define-key map [(control ?c) left] 'picture-movement-left) + (define-key map [(control ?c) right] 'picture-movement-right) + (define-key map [(control ?c) up] 'picture-movement-up) + (define-key map [(control ?c) down] 'picture-movement-down) + (define-key map [(control ?c) home] 'picture-movement-nw) + (define-key map [(control ?c) prior] 'picture-movement-ne) + (define-key map [(control ?c) end] 'picture-movement-sw) + (define-key map [(control ?c) next] 'picture-movement-se) + map) + "Keymap used in `picture-mode'.") (defcustom picture-mode-hook nil "If non-nil, its value is called on entry to Picture mode. diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 9472d7df87..af00531137 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -1492,8 +1492,8 @@ Puts point on a blank line between them." (defvar latex-complete-bibtex-cache nil) -(defun latex-string-prefix-p (str1 str2) - (eq t (compare-strings str1 nil nil str2 0 (length str1)))) +(define-obsolete-function-alias 'latex-string-prefix-p + 'string-prefix-p "24.2") (defvar bibtex-reference-key) (declare-function reftex-get-bibfile-list "reftex-cite.el" ()) @@ -1507,7 +1507,7 @@ Puts point on a blank line between them." keys) (if (and (eq (car latex-complete-bibtex-cache) (reftex-get-bibfile-list)) - (latex-string-prefix-p (nth 1 latex-complete-bibtex-cache) + (string-prefix-p (nth 1 latex-complete-bibtex-cache) key)) ;; Use the cache. (setq keys (nth 2 latex-complete-bibtex-cache)) @@ -2051,10 +2051,7 @@ IN can be either a string (with the same % escapes in it) indicating OUT describes the output file and is either a %-escaped string or nil to indicate that there is no output file.") -;; defsubst* gives better byte-code than defsubst. -(defsubst* tex-string-prefix-p (str1 str2) - "Return non-nil if STR1 is a prefix of STR2" - (eq t (compare-strings str2 nil (length str1) str1 nil nil))) +(define-obsolete-function-alias 'tex-string-prefix-p 'string-prefix-p "24.2") (defun tex-guess-main-file (&optional all) "Find a likely `tex-main-file'. @@ -2069,7 +2066,7 @@ of the current buffer." (with-current-buffer buf (when (and (cond ((null all) (equal dir default-directory)) - ((eq all 'sub) (tex-string-prefix-p default-directory dir)) + ((eq all 'sub) (string-prefix-p default-directory dir)) (t)) (stringp tex-main-file)) (throw 'found (expand-file-name tex-main-file))))) @@ -2078,7 +2075,7 @@ of the current buffer." (with-current-buffer buf (when (and (cond ((null all) (equal dir default-directory)) - ((eq all 'sub) (tex-string-prefix-p default-directory dir)) + ((eq all 'sub) (string-prefix-p default-directory dir)) (t)) buffer-file-name ;; (or (easy-mmode-derived-mode-p 'latex-mode) diff --git a/lisp/textmodes/two-column.el b/lisp/textmodes/two-column.el index 40cbbc5929..8a4fe4f87f 100644 --- a/lisp/textmodes/two-column.el +++ b/lisp/textmodes/two-column.el @@ -124,15 +124,51 @@ ;;; Code: - +(defgroup two-column nil + "Minor mode for editing of two-column text." + :prefix "2C-" + :group 'frames) + +(defcustom 2C-mode-line-format + '("-%*- %15b --" (-3 . "%p") "--%[(" mode-name + minor-mode-alist "%n" mode-line-process ")%]%-") + "Value of `mode-line-format' for a buffer in two-column minor mode." + :type 'sexp + :group 'two-column) + +(defcustom 2C-other-buffer-hook 'text-mode + "Hook run in new buffer when it is associated with current one." + :type 'function + :group 'two-column) -;; Lucid patch -(or (fboundp 'frame-width) - (fset 'frame-width 'screen-width)) +(defcustom 2C-separator "" + "A string inserted between the two columns when merging. +This gets set locally by \\[2C-split]." + :type 'string + :group 'two-column) +(put '2C-separator 'permanent-local t) + +(defcustom 2C-window-width 40 + "The width of the first column. (Must be at least `window-min-width'.) +This value is local for every buffer that sets it." + :type 'integer + :group 'two-column) +(make-variable-buffer-local '2C-window-width) +(put '2C-window-width 'permanent-local t) +(defcustom 2C-beyond-fill-column 4 + "Base for calculating `fill-column' for a buffer in two-column minor mode. +The value of `fill-column' becomes `2C-window-width' for this buffer +minus this value." + :type 'integer + :group 'two-column) -;;;;; Set up keymap ;;;;; +(defcustom 2C-autoscroll t + "If non-nil, Emacs attempts to keep the two column's buffers aligned." + :type 'boolean + :group 'two-column) + (defvar 2C-mode-map (let ((map (make-sparse-keymap))) (define-key map "2" '2C-two-columns) @@ -142,8 +178,6 @@ map) "Keymap for commands for setting up two-column mode.") - - ;;;###autoload (autoload '2C-command "two-column" () t 'keymap) (fset '2C-command 2C-mode-map) @@ -154,7 +188,6 @@ ;;;###autoload (global-set-key [f2] '2C-command) - (defvar 2C-minor-mode-map (let ((map (make-sparse-keymap))) (define-key map "1" '2C-merge) @@ -167,7 +200,6 @@ map) "Keymap for commands for use in two-column mode.") - (setq minor-mode-map-alist (cons (cons '2C-mode (let ((map (make-sparse-keymap))) @@ -181,15 +213,8 @@ map (current-global-map)) map)) minor-mode-map-alist)) - -;;;;; variable declarations ;;;;; - -(defgroup two-column nil - "Minor mode for editing of two-column text." - :prefix "2C-" - :group 'frames) - + ;; Markers seem to be the only buffer-id not affected by renaming a buffer. ;; This nevertheless loses when a buffer is killed. The variable-name is ;; required by `describe-mode'. @@ -198,62 +223,8 @@ (make-variable-buffer-local '2C-mode) (put '2C-mode 'permanent-local t) - - (setq minor-mode-alist (cons '(2C-mode " 2C") minor-mode-alist)) - - -;; rearranged, so that the pertinent info will show in 40 columns -(defcustom 2C-mode-line-format - '("-%*- %15b --" (-3 . "%p") "--%[(" mode-name - minor-mode-alist "%n" mode-line-process ")%]%-") - "Value of `mode-line-format' for a buffer in two-column minor mode." - :type 'sexp - :group 'two-column) - - -(defcustom 2C-other-buffer-hook 'text-mode - "Hook run in new buffer when it is associated with current one." - :type 'function - :group 'two-column) - - -(defcustom 2C-separator "" - "A string inserted between the two columns when merging. -This gets set locally by \\[2C-split]." - :type 'string - :group 'two-column) -(put '2C-separator 'permanent-local t) - - - -(defcustom 2C-window-width 40 - "The width of the first column. (Must be at least `window-min-width') -This value is local for every buffer that sets it." - :type 'integer - :group 'two-column) -(make-variable-buffer-local '2C-window-width) -(put '2C-window-width 'permanent-local t) - - - -(defcustom 2C-beyond-fill-column 4 - "Base for calculating `fill-column' for a buffer in two-column minor mode. -The value of `fill-column' becomes `2C-window-width' for this buffer -minus this value." - :type 'integer - :group 'two-column) - - - -(defcustom 2C-autoscroll t - "If non-nil, Emacs attempts to keep the two column's buffers aligned." - :type 'boolean - :group 'two-column) - - - (defvar 2C-autoscroll-start nil) (make-variable-buffer-local '2C-autoscroll-start) @@ -276,7 +247,6 @@ minus this value." (if req (error "You must first set two-column minor mode")))) - ;; function for setting up two-column minor mode in a buffer associated ;; with the buffer pointed to by the marker other. (defun 2C-mode (other) @@ -320,7 +290,6 @@ The appearance of the screen can be customized by the variables (run-hooks '2C-mode-hook)) - ;;;###autoload (defun 2C-two-columns (&optional buffer) "Split current window vertically for two-column editing. @@ -356,7 +325,6 @@ first and the associated buffer to its right." (other-window -1))))) - ;;;###autoload (defun 2C-associate-buffer () "Associate another buffer with this one in two-column minor mode. @@ -368,9 +336,8 @@ accepting the proposed default buffer. (let ((b1 (current-buffer)) (b2 (or (2C-other) (read-buffer "Associate buffer: " (other-buffer))))) - (save-excursion - (setq 2C-mode nil) - (set-buffer b2) + (setq 2C-mode nil) + (with-current-buffer b2 (and (2C-other) (not (eq b1 (2C-other))) (error "Buffer already associated with buffer `%s'" @@ -382,7 +349,6 @@ accepting the proposed default buffer. (2C-two-columns b2))) - ;;;###autoload (defun 2C-split (arg) "Split a two-column text at point, into two buffers in two-column minor mode. @@ -454,32 +420,28 @@ First column's text sSs Second column's text (move-to-column column))))) - - (defun 2C-dissociate () "Turn off two-column minor mode in current and associated buffer. If the associated buffer is unmodified and empty, it is killed." (interactive) - (let ((buffer (current-buffer))) - (save-excursion - (and (2C-other) - (set-buffer (2C-other)) - (or (not (2C-other)) - (eq buffer (2C-other))) - (if (and (not (buffer-modified-p)) - (eobp) (bobp)) - (kill-buffer nil) - (kill-local-variable '2C-mode) - (kill-local-variable '2C-window-width) - (kill-local-variable '2C-separator) - (kill-local-variable 'mode-line-format) - (kill-local-variable 'fill-column)))) - (kill-local-variable '2C-mode) - (kill-local-variable '2C-window-width) - (kill-local-variable '2C-separator) - (kill-local-variable 'mode-line-format) - (kill-local-variable 'fill-column))) - + (let ((buffer (current-buffer)) + (other (2C-other))) + (if other + (with-current-buffer other + (when (or (not (2C-other)) (eq buffer (2C-other))) + (if (and (not (buffer-modified-p)) (zerop (buffer-size))) + (kill-buffer) + (kill-local-variable '2C-mode) + (kill-local-variable '2C-window-width) + (kill-local-variable '2C-separator) + (kill-local-variable 'mode-line-format) + (kill-local-variable 'fill-column)))))) + (kill-local-variable '2C-mode) + (kill-local-variable '2C-window-width) + (kill-local-variable '2C-separator) + (kill-local-variable 'mode-line-format) + (kill-local-variable 'fill-column) + (force-mode-line-update)) ;; this doesn't use yank-rectangle, so that the first column can @@ -578,7 +540,6 @@ on, this also realigns the two buffers." (message "Autoscrolling is off."))) - (defun 2C-autoscroll () (if 2C-autoscroll ;; catch a mouse scroll on non-selected scrollbar @@ -590,27 +551,25 @@ on, this also realigns the two buffers." (select-window (car (car (cdr last-command-event))))) ;; In some cases scrolling causes an error, but post-command-hook ;; shouldn't, and should always stay in the original window - (condition-case () - (and (or 2C-autoscroll-start (2C-toggle-autoscroll t) nil) - (/= (window-start) 2C-autoscroll-start) - (2C-other) - (get-buffer-window (2C-other)) - (let ((lines (count-lines (window-start) - 2C-autoscroll-start))) - (if (< (window-start) 2C-autoscroll-start) - (setq lines (- lines))) - (setq 2C-autoscroll-start (window-start)) - (select-window (get-buffer-window (2C-other))) - ;; make sure that other buffer has enough lines - (save-excursion - (insert-char - ?\n (- lines (count-lines (window-start) - (goto-char (point-max))) - -1))) - (scroll-up lines) - (setq 2C-autoscroll-start (window-start)))) - (error)))))) - + (ignore-errors + (and (or 2C-autoscroll-start (2C-toggle-autoscroll t) nil) + (/= (window-start) 2C-autoscroll-start) + (2C-other) + (get-buffer-window (2C-other)) + (let ((lines (count-lines (window-start) + 2C-autoscroll-start))) + (if (< (window-start) 2C-autoscroll-start) + (setq lines (- lines))) + (setq 2C-autoscroll-start (window-start)) + (select-window (get-buffer-window (2C-other))) + ;; make sure that other buffer has enough lines + (save-excursion + (insert-char + ?\n (- lines (count-lines (window-start) + (goto-char (point-max))) + -1))) + (scroll-up lines) + (setq 2C-autoscroll-start (window-start))))))))) (defun 2C-enlarge-window-horizontally (arg) @@ -628,7 +587,6 @@ on, this also realigns the two buffers." (2C-enlarge-window-horizontally (- arg))) - (provide 'two-column) ;;; two-column.el ends here diff --git a/lisp/vc/pcvs-util.el b/lisp/vc/pcvs-util.el index b300247e55..a3c525cb89 100644 --- a/lisp/vc/pcvs-util.el +++ b/lisp/vc/pcvs-util.el @@ -182,9 +182,7 @@ arguments. If ARGS is not a list, no argument will be passed." (if oneline (line-end-position) (point-max)))) (file-error nil))) -(defun cvs-string-prefix-p (str1 str2) - "Tell whether STR1 is a prefix of STR2." - (eq t (compare-strings str2 nil (length str1) str1 nil nil))) +(define-obsolete-function-alias 'cvs-string-prefix-p 'string-prefix-p "24.2") ;;;; ;;;; file names diff --git a/lisp/vc/pcvs.el b/lisp/vc/pcvs.el index 9ba65cda14..6aec24755b 100644 --- a/lisp/vc/pcvs.el +++ b/lisp/vc/pcvs.el @@ -432,8 +432,8 @@ If non-nil, NEW means to create a new buffer no matter what." (case cvs-reuse-cvs-buffer (always t) (subdir - (or (cvs-string-prefix-p default-directory dir) - (cvs-string-prefix-p dir default-directory))) + (or (string-prefix-p default-directory dir) + (string-prefix-p dir default-directory))) (samedir (string= default-directory dir))) (return buffer))))) ;; we really have to create a new buffer: @@ -887,7 +887,7 @@ RM-MSGS if non-nil means remove messages." (eq (cvs-fileinfo->type last-fi) 'DIRCHANGE) (not (when first-dir (setq first-dir nil) t)) (or (eq rm-dirs 'all) - (not (cvs-string-prefix-p + (not (string-prefix-p (cvs-fileinfo->dir last-fi) (cvs-fileinfo->dir fi))) (and (eq type 'DIRCHANGE) (eq rm-dirs 'empty)) @@ -1839,7 +1839,7 @@ Signal an error if there is no backup file." (setq buffer-file-name (expand-file-name buffer-file-name)) (let (ret) (dolist (fi (or fis (list (cvs-create-fileinfo 'DIRCHANGE "" "." "")))) - (when (cvs-string-prefix-p + (when (string-prefix-p (expand-file-name (cvs-fileinfo->full-name fi) dir) buffer-file-name) (setq ret t))) @@ -2261,7 +2261,7 @@ With prefix argument, prompt for cvs flags." (defun cvs-dir-member-p (fileinfo dir) "Return true if FILEINFO represents a file in directory DIR." (and (not (eq (cvs-fileinfo->type fileinfo) 'DIRCHANGE)) - (cvs-string-prefix-p dir (cvs-fileinfo->dir fileinfo)))) + (string-prefix-p dir (cvs-fileinfo->dir fileinfo)))) (defun cvs-execute-single-file (fi extractor program constant-args) "Internal function for `cvs-execute-single-file-list'." @@ -2392,7 +2392,7 @@ The exact behavior is determined also by `cvs-dired-use-hook'." (set-buffer cvs-buf) ;; look for a corresponding pcl-cvs buffer (when (and (eq major-mode 'cvs-mode) - (cvs-string-prefix-p default-directory dir)) + (string-prefix-p default-directory dir)) (let ((subdir (substring dir (length default-directory)))) (set-buffer buffer) (set (make-local-variable 'cvs-buffer) cvs-buf) @@ -2423,7 +2423,7 @@ The exact behavior is determined also by `cvs-dired-use-hook'." (set-buffer cvs-buf) ;; look for a corresponding pcl-cvs buffer (when (and (eq major-mode 'cvs-mode) - (cvs-string-prefix-p default-directory file)) + (string-prefix-p default-directory file)) (let* ((file (substring file (length default-directory))) (fi (cvs-create-fileinfo (if (string= "0" version) diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 33611b4eaf..4c32eea2f7 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -1,6 +1,6 @@ ;;; vc-dir.el --- Directory status display under VC -;; Copyright (C) 2007-2012 Free Software Foundation, Inc. +;; Copyright (C) 2007-2012 Free Software Foundation, Inc. ;; Author: Dan Nicolaescu ;; Keywords: vc tools @@ -556,7 +556,7 @@ If a prefix argument is given, move by that many lines." (let ((data (ewoc-data crt)) (dir (vc-dir-node-directory crt))) (and (vc-dir-fileinfo->directory data) - (vc-string-prefix-p dir argdir) + (string-prefix-p dir argdir) (vc-dir-fileinfo->marked data) (setq found data)))) found)) @@ -818,7 +818,7 @@ child files." data) (while (and (setq crt (ewoc-next vc-ewoc crt)) - (vc-string-prefix-p dir + (string-prefix-p dir (progn (setq data (ewoc-data crt)) (vc-dir-node-directory crt)))) @@ -846,7 +846,7 @@ If it is a file, return the corresponding cons for the file itself." data) (while (and (setq crt (ewoc-next vc-ewoc crt)) - (vc-string-prefix-p dir (progn + (string-prefix-p dir (progn (setq data (ewoc-data crt)) (vc-dir-node-directory crt)))) (unless (vc-dir-fileinfo->directory data) @@ -878,10 +878,10 @@ If it is a file, return the corresponding cons for the file itself." children dname) ;; Find DIR - (while (and crt (not (vc-string-prefix-p + (while (and crt (not (string-prefix-p dirname (vc-dir-node-directory crt)))) (setq crt (ewoc-next vc-ewoc crt))) - (while (and crt (vc-string-prefix-p + (while (and crt (string-prefix-p dirname (setq dname (vc-dir-node-directory crt)))) (let ((data (ewoc-data crt))) @@ -915,7 +915,7 @@ If it is a file, return the corresponding cons for the file itself." (if (not (derived-mode-p 'vc-dir-mode)) (push status-buf drop) (let ((ddir default-directory)) - (when (vc-string-prefix-p ddir file) + (when (string-prefix-p ddir file) (if (file-directory-p file) (progn (vc-dir-resync-directory-files file) diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el index ec1b127dd1..95c1503095 100644 --- a/lisp/vc/vc-dispatcher.el +++ b/lisp/vc/vc-dispatcher.el @@ -537,13 +537,12 @@ editing!" (kill-buffer (current-buffer))))) (declare-function vc-dir-resynch-file "vc-dir" (&optional fname)) -(declare-function vc-string-prefix-p "vc" (prefix string)) (defun vc-resynch-buffers-in-directory (directory &optional keep noquery reset-vc-info) "Resync all buffers that visit files in DIRECTORY." (dolist (buffer (buffer-list)) (let ((fname (buffer-file-name buffer))) - (when (and fname (vc-string-prefix-p directory fname)) + (when (and fname (string-prefix-p directory fname)) (with-current-buffer buffer (vc-resynch-buffer fname keep noquery reset-vc-info)))))) diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 52e8051342..a272826881 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2006-2012 Free Software Foundation, Inc. ;; Author: Ivan Kanis +;; Maintainer: FSF ;; Keywords: vc tools ;; Package: vc diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 4cbbf47c2d..ab7e587eb7 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1,6 +1,6 @@ ;;; vc.el --- drive a version-control system from within Emacs -;; Copyright (C) 1992-1998, 2000-2012 Free Software Foundation, Inc. +;; Copyright (C) 1992-1998, 2000-2012 Free Software Foundation, Inc. ;; Author: FSF (see below for full credits) ;; Maintainer: Andre Spiegel @@ -847,7 +847,7 @@ been updated to their corresponding values." (if (file-directory-p file) (dolist (buffer (buffer-list)) (let ((fname (buffer-file-name buffer))) - (when (and fname (vc-string-prefix-p file fname)) + (when (and fname (string-prefix-p file fname)) (push fname flist)))) (push file flist))) ,form @@ -900,7 +900,7 @@ use." (lambda (arg) (message "arg %s" arg) (and (file-directory-p arg) - (vc-string-prefix-p (expand-file-name arg) def-dir))))))) + (string-prefix-p (expand-file-name arg) def-dir))))))) (let ((default-directory repo-dir)) (vc-call-backend bk 'create-repo)) (throw 'found bk)))) @@ -2809,11 +2809,7 @@ to provide the `find-revision' operation instead." ;; These things should probably be generally available - -(defun vc-string-prefix-p (prefix string) - (let ((lpref (length prefix))) - (and (>= (length string) lpref) - (eq t (compare-strings prefix nil nil string nil lpref))))) +(define-obsolete-function-alias 'vc-string-prefix-p 'string-prefix-p "24.2") (defun vc-file-tree-walk (dirname func &rest args) "Walk recursively through DIRNAME. diff --git a/lisp/woman.el b/lisp/woman.el index c76399a96e..98ab27716a 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -1,6 +1,6 @@ ;;; woman.el --- browse UN*X manual pages `wo (without) man' -;; Copyright (C) 2000-2012 Free Software Foundation, Inc. +;; Copyright (C) 2000-2012 Free Software Foundation, Inc. ;; Author: Francis J. Wright ;; Maintainer: FSF @@ -1595,14 +1595,6 @@ Also make each path-info component into a list. (woman-process-buffer) (goto-char (point-min))))) -;; There is currently no `tar-mode-hook' so use ... -(eval-after-load "tar-mode" - '(progn - (define-key tar-mode-map "w" 'woman-tar-extract-file) - (define-key-after (lookup-key tar-mode-map [menu-bar immediate]) - [woman] '("Read Man Page (WoMan)" . woman-tar-extract-file) 'view))) - - (defvar woman-last-file-name nil "The full pathname of the last file formatted by WoMan.") diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index 85b69f47d2..f6ffedeafd 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -1,4 +1,4 @@ -2012-04-14 Paul Eggert +2012-04-17 Paul Eggert configure: new option --enable-gcc-warnings (Bug#11207) * Makefile.in (C_WARNINGS_SWITCH): Remove. diff --git a/msdos/ChangeLog b/msdos/ChangeLog index fa7dc23471..bf3a11d5bd 100644 --- a/msdos/ChangeLog +++ b/msdos/ChangeLog @@ -1,4 +1,4 @@ -2012-04-14 Paul Eggert +2012-04-17 Paul Eggert configure: new option --enable-gcc-warnings (Bug#11207) * sed1v2.inp, sed3v2.inp, sedlibmk.inp: GNULIB_WARN_CFLAGS, diff --git a/oldXMenu/ChangeLog b/oldXMenu/ChangeLog index a76ea61abd..243899e011 100644 --- a/oldXMenu/ChangeLog +++ b/oldXMenu/ChangeLog @@ -1,4 +1,4 @@ -2012-04-14 Paul Eggert +2012-04-17 Paul Eggert configure: new option --enable-gcc-warnings (Bug#11207) * Makefile.in (C_WARNINGS_SWITCH): Remove. diff --git a/src/ChangeLog b/src/ChangeLog index 7362bf462a..78fa3b501a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,25 @@ +2012-04-17 Paul Eggert + + configure: new option --enable-gcc-warnings (Bug#11207) + * Makefile.in (C_WARNINGS_SWITCH): Remove. + (WARN_CFLAGS, WERROR_CFLAGS): New macros. + (ALL_CFLAGS): Use new macros rather than old. + * process.c: Ignore -Wstrict-overflow to work around GCC bug 52904. + * regex.c: Ignore -Wstrict-overflow. If !emacs, also ignore + -Wunused-but-set-variable, -Wunused-function, -Wunused-macros, + -Wunused-result, -Wunused-variable. This should go away once + the Emacs and Gnulib regex code is merged. + (xmalloc, xrealloc): Now static. + +2012-04-17 Glenn Morris + + * dired.c (Fsystem_users): Doc fix. + +2012-04-17 Dmitry Antipov + + * dired.c (Fsystem_users, Fsystem_groups): New functions. (Bug#7900) + (syms_of_dired): Add them. + 2012-04-16 Paul Eggert Fix minor alloc.c problems found by static checking. @@ -40,19 +62,6 @@ aligned_Lisp_Misc instead of union Lisp_Misc. (Fmake_symbol, allocate_misc, gc_sweep): Adjust -2012-04-14 Paul Eggert - - configure: new option --enable-gcc-warnings (Bug#11207) - * Makefile.in (C_WARNINGS_SWITCH): Remove. - (WARN_CFLAGS, WERROR_CFLAGS): New macros. - (ALL_CFLAGS): Use new macros rather than old. - * process.c: Ignore -Wstrict-overflow to work around GCC bug 52904. - * regex.c: Ignore -Wstrict-overflow. If !emacs, also ignore - -Wunused-but-set-variable, -Wunused-function, -Wunused-macros, - -Wunused-result, -Wunused-variable. This should go away once - the Emacs and Gnulib regex code is merged. - (xmalloc, xrealloc): Now static. - 2012-04-14 Paul Eggert Make GC_MAKE_GCPROS_NOOPS the default (Bug#9926). diff --git a/src/dired.c b/src/dired.c index 9b0f94a076..eeae59d280 100644 --- a/src/dired.c +++ b/src/dired.c @@ -1015,6 +1015,46 @@ Comparison is in lexicographic order and case is significant. */) return Fstring_lessp (Fcar (f1), Fcar (f2)); } + +DEFUN ("system-users", Fsystem_users, Ssystem_users, 0, 0, 0, + doc: /* Return a list of user names currently registered in the system. +If we don't know how to determine that on this platform, just +return a list with one element, taken from `user-real-login-name'. */) + (void) +{ + Lisp_Object users = Qnil; +#if defined(HAVE_GETPWENT) && defined(HAVE_ENDPWENT) + struct passwd *pw; + + while ((pw = getpwent ())) + users = Fcons (DECODE_SYSTEM (build_string (pw->pw_name)), users); + + endpwent (); +#endif + if (EQ (users, Qnil)) + /* At least current user is always known. */ + users = Fcons (Vuser_real_login_name, Qnil); + return users; +} + +DEFUN ("system-groups", Fsystem_groups, Ssystem_groups, 0, 0, 0, + doc: /* Return a list of user group names currently registered in the system. +The value may be nil if not supported on this platform. */) + (void) +{ + Lisp_Object groups = Qnil; +#if defined(HAVE_GETGRENT) && defined(HAVE_ENDGRENT) + struct group *gr; + int length; + + while ((gr = getgrent ())) + groups = Fcons (DECODE_SYSTEM (build_string (gr->gr_name)), groups); + + endgrent (); +#endif + return groups; +} + void syms_of_dired (void) { @@ -1032,6 +1072,8 @@ syms_of_dired (void) defsubr (&Sfile_name_all_completions); defsubr (&Sfile_attributes); defsubr (&Sfile_attributes_lessp); + defsubr (&Ssystem_users); + defsubr (&Ssystem_groups); DEFVAR_LISP ("completion-ignored-extensions", Vcompletion_ignored_extensions, doc: /* Completion ignores file names ending in any string in this list.