changeset 107738:1e30c1690fd8

Merge from trunk
author Jan D. <jan.h.d@swipnet.se>
date Tue, 23 Mar 2010 08:04:35 +0100
parents 8d710e332ba0 (current diff) 0eb017273376 (diff)
children 813096803a4a
files lisp/progmodes/cc-engine.el
diffstat 17 files changed, 118 insertions(+), 124 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS	Mon Mar 22 08:50:40 2010 +0100
+++ b/etc/NEWS	Tue Mar 23 08:04:35 2010 +0100
@@ -94,6 +94,8 @@
 
 * Lisp changes in Emacs 24.1
 
+** New completion style `substring'.
+
 ** Image API
 
 *** When the image type is one of listed in `image-animated-types'
--- a/lisp/ChangeLog	Mon Mar 22 08:50:40 2010 +0100
+++ b/lisp/ChangeLog	Tue Mar 23 08:04:35 2010 +0100
@@ -1,3 +1,20 @@
+2010-03-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	Add a new completion style `substring'.
+	* minibuffer.el (completion-basic--pattern): New function.
+	(completion-basic-try-completion, completion-basic-all-completions):
+	Use it.
+	(completion-substring--all-completions)
+	(completion-substring-try-completion)
+	(completion-substring-all-completions): New functions.
+	(completion-styles-alist): New style `substring'.
+
+2010-03-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	Get rid of .elc files after removal of the corresponding .el.
+	* Makefile.in (compile-clean): New target.
+	(compile-main): Use it.
+
 2010-03-22  Jan Djärv  <jan.h.d@swipnet.se>
 
 	* Makefile.in (compile-main): cd to $(lisp) in a sub-shell, so we
@@ -19,7 +36,8 @@
 	(srcdir): Don't append `/..'.
 	(EMACS): Use ${abs_top_builddir}.
 	(all, compile, compile-always, compile-last): Don't set emacswd.
-	(update-subdirs, update-authors): Use $(top_srcdir) instead of $(srcdir).
+	(update-subdirs, update-authors): Use $(top_srcdir) instead of
+	$(srcdir).
 	(lisp): Use $(srcdir) instead of @srcdir@.
 
 2010-03-21  Juri Linkov  <juri@jurta.org>
--- a/lisp/Makefile.in	Mon Mar 22 08:50:40 2010 +0100
+++ b/lisp/Makefile.in	Tue Mar 23 08:04:35 2010 +0100
@@ -235,7 +235,7 @@
 
 # Compile all the Elisp files that need it.  Beware: it approximates
 # `no-byte-compile', so watch out for false-positives!
-compile-main:
+compile-main: compile-clean
 	@(cd $(lisp); $(setwins); \
 	els=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
 	for el in $$els; do \
@@ -247,6 +247,18 @@
 	  $(MAKE) $(MFLAGS) compile-targets EMACS="$(EMACS)" TARGETS="$$chunk"; \
 	done
 
+.PHONY: compile-clean
+# Erase left-over .elc files that do not have a corresponding .el file.
+compile-clean:
+	@cd $(lisp); $(setwins); \
+	elcs=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.elc |g'`; \
+	for el in $$(echo $$elcs | sed -e 's/\.elc/\.el/g'); do \
+	  if test -f "$$el" -o \! -f "$${el}c"; then :; else \
+	    echo rm "$${el}c"; \
+	    rm "$${el}c"; \
+	  fi \
+	done
+
 # Compile all Lisp files, but don't recompile those that are up to
 # date.  Some .el files don't get compiled because they set the
 # local variable no-byte-compile.
--- a/lisp/minibuffer.el	Mon Mar 22 08:50:40 2010 +0100
+++ b/lisp/minibuffer.el	Tue Mar 23 08:04:35 2010 +0100
@@ -393,6 +393,9 @@
      "Completion of multiple words, each one taken as a prefix.
 E.g. M-x l-c-h can complete to list-command-history
 and C-x C-f /u/m/s to /usr/monnier/src.")
+    (substring
+     completion-substring-try-completion completion-substring-all-completions
+     "Completion of the string taken as a substring.")
     (initials
      completion-initials-try-completion completion-initials-all-completions
      "Completion of acronyms and initialisms.
@@ -1658,6 +1661,12 @@
     ;; Nothing to merge.
     suffix))
 
+(defun completion-basic--pattern (beforepoint afterpoint bounds)
+  (delete
+   "" (list (substring beforepoint (car bounds))
+            'point
+            (substring afterpoint 0 (cdr bounds)))))
+
 (defun completion-basic-try-completion (string table pred point)
   (let* ((beforepoint (substring string 0 point))
          (afterpoint (substring string point))
@@ -1674,10 +1683,8 @@
              (length completion))))
       (let* ((suffix (substring afterpoint (cdr bounds)))
              (prefix (substring beforepoint 0 (car bounds)))
-             (pattern (delete
-                       "" (list (substring beforepoint (car bounds))
-                                'point
-                                (substring afterpoint 0 (cdr bounds)))))
+             (pattern (completion-basic--pattern
+                       beforepoint afterpoint bounds))
              (all (completion-pcm--all-completions prefix pattern table pred)))
         (if minibuffer-completing-file-name
             (setq all (completion-pcm--filename-try-filter all)))
@@ -1687,12 +1694,8 @@
   (let* ((beforepoint (substring string 0 point))
          (afterpoint (substring string point))
          (bounds (completion-boundaries beforepoint table pred afterpoint))
-         (suffix (substring afterpoint (cdr bounds)))
          (prefix (substring beforepoint 0 (car bounds)))
-         (pattern (delete
-                   "" (list (substring beforepoint (car bounds))
-                            'point
-                            (substring afterpoint 0 (cdr bounds)))))
+         (pattern (completion-basic--pattern beforepoint afterpoint bounds))
          (all (completion-pcm--all-completions prefix pattern table pred)))
     (completion-hilit-commonality all point (car bounds))))
 
@@ -2069,7 +2072,38 @@
            'completion-pcm--filename-try-filter))
     (completion-pcm--merge-try pattern all prefix suffix)))
 
-;;; Initials completion
+;;; Substring completion
+;; Mostly derived from the code of `basic' completion.
+
+(defun completion-substring--all-completions (string table pred point)
+  (let* ((beforepoint (substring string 0 point))
+         (afterpoint (substring string point))
+         (bounds (completion-boundaries beforepoint table pred afterpoint))
+         (suffix (substring afterpoint (cdr bounds)))
+         (prefix (substring beforepoint 0 (car bounds)))
+         (basic-pattern (completion-basic--pattern
+                         beforepoint afterpoint bounds))
+         (pattern (if (not (stringp (car basic-pattern)))
+                      basic-pattern
+                    (cons 'any basic-pattern)))
+         (all (completion-pcm--all-completions prefix pattern table pred)))
+    (list all pattern prefix suffix (car bounds))))
+
+(defun completion-substring-try-completion (string table pred point)
+  (destructuring-bind (all pattern prefix suffix carbounds)
+      (completion-substring--all-completions string table pred point)
+    (if minibuffer-completing-file-name
+        (setq all (completion-pcm--filename-try-filter all)))
+    (completion-pcm--merge-try pattern all prefix suffix)))
+
+(defun completion-substring-all-completions (string table pred point)
+  (destructuring-bind (all pattern prefix suffix carbounds)
+      (completion-substring--all-completions string table pred point)
+    (when all
+      (nconc (completion-pcm--hilit-commonality pattern all)
+             (length prefix)))))
+
+;; Initials completion
 ;; Complete /ums to /usr/monnier/src or lch to list-command-history.
 
 (defun completion-initials-expand (str table pred)
--- a/lisp/progmodes/cc-engine.el	Mon Mar 22 08:50:40 2010 +0100
+++ b/lisp/progmodes/cc-engine.el	Tue Mar 23 08:04:35 2010 +0100
@@ -2624,7 +2624,7 @@
 			   (< (point-max) c-state-old-cpp-end)))
 		  (point-max)
 		(min (point-max) c-state-old-cpp-beg)))
-	(while (and c-state-cache (> (c-state-cache-top-lparen) upper-lim))
+	(while (and c-state-cache (>= (c-state-cache-top-lparen) upper-lim))
 	  (setq c-state-cache (cdr c-state-cache)))
 	;; If `upper-lim' is inside the last recorded brace pair, remove its
 	;; RBrace and indicate we'll need to search backwards for a previous
--- a/src/ChangeLog	Mon Mar 22 08:50:40 2010 +0100
+++ b/src/ChangeLog	Tue Mar 23 08:04:35 2010 +0100
@@ -1,5 +1,28 @@
+2010-03-23  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* s/gnu-linux.h (LIBS_SYSTEM): Remove, same as default.
+
+	Simplify LIBS_MACHINE definitions.
+	* m/hp800.h (LIBS_MACHINE): Remove, same as default.
+	* m/iris4d.h (LIBS_MACHINE): Likewise.
+	* m/ibmrs6000.h (LIBS_MACHINE): Rename to LIBS_SYSTEM and move ...
+	* s/aix4-2.h (LIBS_SYSTEM): ... here.
+	* s/netbsd.h: Remove commented out code.
+
 2010-03-22  Dan Nicolaescu  <dann@ics.uci.edu>
 
+	Remove dead code dealing with POSIX_SIGNALS.
+	* atimer.c (set_alarm): Remove dead code, all USG systems define
+	POSIX_SIGNALS.
+	* data.c (arith_error): Likewise.
+	* keyboard.c (input_available_signal, handle_user_signal)
+	(interrupt_signal): Likewise.
+	* process.c (sigchld_handler): Likewise.
+	(create_process): Remove if 0 code.  Remove HPUX conditional when
+	!defined (POSIX_SIGNALS), it cannot be true.
+	* syssignal.h: Remove USG5_4 and USG conditionals when
+	!POSIX_SIGNALS, they cannot be true.
+
 	* keyboard.c (Fset_input_interrupt_mode): Remove code depending on
 	NO_SOCK_SIGIO, not used anymore.
 
--- a/src/atimer.c	Mon Mar 22 08:50:40 2010 +0100
+++ b/src/atimer.c	Tue Mar 23 08:04:35 2010 +0100
@@ -296,12 +296,6 @@
 static void
 set_alarm ()
 {
-#if defined (USG) && !defined (POSIX_SIGNALS)
-  /* USG systems forget handlers when they are used;
-     must reestablish each time.  */
-  signal (SIGALRM, alarm_signal_handler);
-#endif /* USG */
-
   if (atimers)
     {
       EMACS_TIME now, time;
--- a/src/data.c	Mon Mar 22 08:50:40 2010 +0100
+++ b/src/data.c	Tue Mar 23 08:04:35 2010 +0100
@@ -3291,11 +3291,6 @@
 arith_error (signo)
      int signo;
 {
-#if defined(USG) && !defined(POSIX_SIGNALS)
-  /* USG systems forget handlers when they are used;
-     must reestablish each time */
-  signal (signo, arith_error);
-#endif /* USG */
   sigsetmask (SIGEMPTYMASK);
 
   SIGNAL_THREAD_CHECK (signo);
--- a/src/keyboard.c	Mon Mar 22 08:50:40 2010 +0100
+++ b/src/keyboard.c	Tue Mar 23 08:04:35 2010 +0100
@@ -7507,12 +7507,6 @@
 {
   /* Must preserve main program's value of errno.  */
   int old_errno = errno;
-#if defined (USG) && !defined (POSIX_SIGNALS)
-  /* USG systems forget handlers when they are used;
-     must reestablish each time */
-  signal (signo, input_available_signal);
-#endif /* USG */
-
   SIGNAL_THREAD_CHECK (signo);
 
 #ifdef SYNC_INPUT
@@ -7595,12 +7589,6 @@
   int old_errno = errno;
   struct user_signal_info *p;
 
-#if defined (USG) && !defined (POSIX_SIGNALS)
-  /* USG systems forget handlers when they are used;
-     must reestablish each time */
-  signal (sig, handle_user_signal);
-#endif
-
   SIGNAL_THREAD_CHECK (sig);
 
   for (p = user_signals; p; p = p->next)
@@ -11089,13 +11077,6 @@
   int old_errno = errno;
   struct terminal *terminal;
 
-#if defined (USG) && !defined (POSIX_SIGNALS)
-  /* USG systems forget handlers when they are used;
-     must reestablish each time */
-  signal (SIGINT, interrupt_signal);
-  signal (SIGQUIT, interrupt_signal);
-#endif /* USG */
-
   SIGNAL_THREAD_CHECK (signalnum);
 
   /* See if we have an active terminal on our controlling tty. */
--- a/src/m/hp800.h	Mon Mar 22 08:50:40 2010 +0100
+++ b/src/m/hp800.h	Tue Mar 23 08:04:35 2010 +0100
@@ -93,7 +93,6 @@
 
 #define UNEXEC unexhp9k800.o
 
-#define LIBS_MACHINE
 #define LIBS_DEBUG
 
 /* Include the file bsdtty.h, since this machine has job control.  */
--- a/src/m/ibmrs6000.h	Mon Mar 22 08:50:40 2010 +0100
+++ b/src/m/ibmrs6000.h	Tue Mar 23 08:04:35 2010 +0100
@@ -57,15 +57,6 @@
 #define NLIST_STRUCT
 #endif
 
-/* -lpthreads seems to be necessary for Xlib in X11R6, and should be harmless
-   on older versions of X where it happens to exist.  */
-#ifdef HAVE_LIBPTHREADS
-#define LIBS_MACHINE -lrts -lIM -liconv -lpthreads
-#else
-/* IBM's X11R5 use -lIM and -liconv in AIX 3.2.2.  */
-#define LIBS_MACHINE -lrts -lIM -liconv
-#endif
-
 #undef ADDR_CORRECT
 #define ADDR_CORRECT(x) ((int)(x))
 
--- a/src/m/iris4d.h	Mon Mar 22 08:50:40 2010 +0100
+++ b/src/m/iris4d.h	Tue Mar 23 08:04:35 2010 +0100
@@ -53,8 +53,6 @@
 #define DATA_START 0x10000000
 #define DATA_SEG_BITS	0x10000000
 
-#undef LIBS_MACHINE
-#define LIBS_MACHINE
 #define LIBS_DEBUG
 
 /* Use terminfo instead of termcap.  */
--- a/src/process.c	Mon Mar 22 08:50:40 2010 +0100
+++ b/src/process.c	Tue Mar 23 08:04:35 2010 +0100
@@ -1878,13 +1878,7 @@
 #ifdef AIX
   struct sigaction sighup_action;
 #endif
-#else /* !POSIX_SIGNALS */
-#if 0
-#ifdef SIGCHLD
-  SIGTYPE (*sigchld)();
-#endif
-#endif /* 0 */
-#endif /* !POSIX_SIGNALS */
+#endif /* POSIX_SIGNALS */
   /* Use volatile to protect variables from being clobbered by longjmp.  */
   volatile int forkin, forkout;
   volatile int pty_flag = 0;
@@ -2008,14 +2002,9 @@
   sigprocmask (SIG_BLOCK, &blocked, &procmask);
 #else /* !POSIX_SIGNALS */
 #ifdef SIGCHLD
-#if defined (BSD_SYSTEM) || defined (HPUX)
+#if defined (BSD_SYSTEM)
   sigsetmask (sigmask (SIGCHLD));
-#else /* ordinary USG */
-#if 0
-  sigchld_deferred = 0;
-  sigchld = signal (SIGCHLD, create_process_sigchld);
-#endif
-#endif /* ordinary USG */
+#endif /* BSD_SYSTEM */
 #endif /* SIGCHLD */
 #endif /* !POSIX_SIGNALS */
 
@@ -2172,13 +2161,9 @@
 	sigprocmask (SIG_SETMASK, &procmask, 0);
 #else /* !POSIX_SIGNALS */
 #ifdef SIGCHLD
-#if defined (BSD_SYSTEM) || defined (HPUX)
+#if defined (BSD_SYSTEM)
 	sigsetmask (SIGEMPTYMASK);
-#else /* ordinary USG */
-#if 0
-	signal (SIGCHLD, sigchld);
-#endif
-#endif /* ordinary USG */
+#endif /* BSD_SYSTEM */
 #endif /* SIGCHLD */
 #endif /* !POSIX_SIGNALS */
 
@@ -2275,17 +2260,9 @@
   sigprocmask (SIG_SETMASK, &procmask, 0);
 #else /* !POSIX_SIGNALS */
 #ifdef SIGCHLD
-#if defined (BSD_SYSTEM) || defined (HPUX)
+#if defined (BSD_SYSTEM)
   sigsetmask (SIGEMPTYMASK);
-#else /* ordinary USG */
-#if 0
-  signal (SIGCHLD, sigchld);
-  /* Now really handle any of these signals
-     that came in during this function.  */
-  if (sigchld_deferred)
-    kill (getpid (), SIGCHLD);
-#endif
-#endif /* ordinary USG */
+#endif /* BSD_SYSTEM */
 #endif /* SIGCHLD */
 #endif /* !POSIX_SIGNALS */
 
@@ -6704,11 +6681,6 @@
 	  /* PID == 0 means no processes found, PID == -1 means a real
 	     failure.  We have done all our job, so return.  */
 
-	  /* USG systems forget handlers when they are used;
-	     must reestablish each time */
-#if defined (USG) && !defined (POSIX_SIGNALS)
-	  signal (signo, sigchld_handler);   /* WARNING - must come after wait3() */
-#endif
 	  errno = old_errno;
 	  return;
 	}
@@ -6809,9 +6781,6 @@
 #if (defined WINDOWSNT \
      || (defined USG && !defined GNU_LINUX \
 	 && !(defined HPUX && defined WNOHANG)))
-#if defined (USG) && ! defined (POSIX_SIGNALS)
-      signal (signo, sigchld_handler);
-#endif
       errno = old_errno;
       return;
 #endif /* USG, but not HPUX with WNOHANG */
--- a/src/s/aix4-2.h	Mon Mar 22 08:50:40 2010 +0100
+++ b/src/s/aix4-2.h	Tue Mar 23 08:04:35 2010 +0100
@@ -95,6 +95,15 @@
 
 #define LIB_STANDARD
 
+/* -lpthreads seems to be necessary for Xlib in X11R6, and should be harmless
+   on older versions of X where it happens to exist.  */
+#ifdef HAVE_LIBPTHREADS
+#define LIBS_SYSTEM -lrts -lIM -liconv -lpthreads
+#else
+/* IBM's X11R5 use -lIM and -liconv in AIX 3.2.2.  */
+#define LIBS_SYSTEM -lrts -lIM -liconv
+#endif
+
 /* Use terminfo instead of termcap.  */
 
 #define TERMINFO
--- a/src/s/gnu-linux.h	Mon Mar 22 08:50:40 2010 +0100
+++ b/src/s/gnu-linux.h	Tue Mar 23 08:04:35 2010 +0100
@@ -207,9 +207,6 @@
 #define C_DEBUG_SWITCH
 #endif
 
-/* alane@wozzle.linet.org says that -lipc is not a separate library,
-   since libc-4.4.1.  So -lipc was deleted.  */
-#define LIBS_SYSTEM
 /* _BSD_SOURCE is redundant, at least in glibc2, since we define
    _GNU_SOURCE.  Left in in case it's relevant to libc5 systems and
    anyone's still using Emacs on those.  --fx 2002-12-14  */
--- a/src/s/netbsd.h	Mon Mar 22 08:50:40 2010 +0100
+++ b/src/s/netbsd.h	Tue Mar 23 08:04:35 2010 +0100
@@ -26,8 +26,6 @@
 
 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
 
-/* -lutil is not needed for NetBSD >0.9.  */
-/* #define LIBS_SYSTEM -lutil */
 #define LIBS_TERMCAP -ltermcap
 
 #define NEED_ERRNO
--- a/src/syssignal.h	Mon Mar 22 08:50:40 2010 +0100
+++ b/src/syssignal.h	Tue Mar 23 08:04:35 2010 +0100
@@ -88,38 +88,12 @@
 #define sys_sigdel(MASK,SIG) sigdelset (&MASK,SIG)
 
 #else /* ! defined (POSIX_SIGNALS) */
-#ifdef USG5_4
-
-extern SIGMASKTYPE sigprocmask_set;
-
-#ifndef sigblock
-#define sigblock(sig)					\
-     (sigprocmask_set = SIGEMPTYMASK | (sig),		\
-      sigprocmask (SIG_BLOCK, &sigprocmask_set, NULL))
-#endif
-
-#ifndef sigunblock
-#define sigunblock(sig)						\
-     (sigprocmask_set = SIGFULLMASK & ~(sig),			\
-      sigprocmask (SIG_SETMASK, &sigprocmask_set, NULL))
-#endif
-
-#else
-#ifdef USG
-
-#ifndef sigunblock
-#define sigunblock(sig)
-#endif
-
-#else
 
 #ifndef sigunblock
 #define sigunblock(SIG) \
 { SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); }
 #endif
 
-#endif /* ! defined (USG) */
-#endif /* ! defined (USG5_4) */
 #endif /* ! defined (POSIX_SIGNALS) */
 
 #ifndef SIGMASKTYPE