Репозиторий ALT Linux backports/2.4
Последнее обновление: 9 июля 2008 | Пакетов: 497 | Посещений: 1494140
 поиск   регистрация   авторизация 
 
Группа :: Редакторы
Пакет: emacs21

 Главная   Изменения   Спек   Патчи   Загрузить   Bugs and FR 

Патч: emacs-21.3-use-handler-for-load-of-absolute.patch


A part of the diff from CVS.
Check whether a file needs a handler to be opened
for absolute filenames, too. (E.g., absolute compressed
need a handler.)
There is also another patch for the same place, not yet
in the CVS, but in the ALT's pkg: 
use-handler-for-load-of-suffixed.patch
===================================================================
RCS file: /cvsroot/emacs/emacs/src/lread.c,v
retrieving revision 1.257
retrieving revision 1.258
diff -u -r1.257 -r1.258
--- emacs/src/lread.c	2001/10/05 09:49:16	1.257
+++ emacs/src/lread.c	2001/10/12 03:18:05	1.258
@@ -646,13 +646,19 @@
   CHECK_STRING (file, 0);
 
   /* If file name is magic, call the handler.  */
-  handler = Ffind_file_name_handler (file, Qload);
-  if (!NILP (handler))
-    return call5 (handler, Qload, file, noerror, nomessage, nosuffix);
+  /* This shouldn't be necessary any more now that `openp' handles it right.
+    handler = Ffind_file_name_handler (file, Qload);
+    if (!NILP (handler))
+      return call5 (handler, Qload, file, noerror, nomessage, nosuffix); */
 
   /* Do this after the handler to avoid
      the need to gcpro noerror, nomessage and nosuffix.
-     (Below here, we care only whether they are nil or not.)  */
+     (Below here, we care only whether they are nil or not.)
+     The presence of this call is the result of a historical accident:
+     it used to be in every file-operations and when it got removed
+     everywhere, it accidentally stayed here.  Since then, enough people
+     supposedly have things like (load "$PROJECT/foo.el") in their .emacs
+     that it seemed risky to remove.  */
   file = Fsubstitute_in_file_name (file);
 
   /* Avoid weird lossage with null string as arg,
@@ -1009,13 +1024,17 @@
 	  if (lsuffix != 0)  /* Bug happens on CCI if lsuffix is 0.  */
 	    strncat (fn, nsuffix, lsuffix);
 
 	  /* Check that the file exists and is not a directory.  */
-	  if (absolute)
-	    handler = Qnil;
-	  else
-	    handler = Ffind_file_name_handler (filename, Qfile_exists_p);
-	  if (! NILP (handler) && ! exec_only)
+	  /* We used to only check for handlers on non-absolute file names:
+	        if (absolute)
+	          handler = Qnil;
+	        else
+		  handler = Ffind_file_name_handler (filename, Qfile_exists_p);
+	     It's not clear why that was the case and it breaks things like
+	     (load "/bar.el") where the file is actually "/bar.el.gz".  */
+	  handler = Ffind_file_name_handler (filename, Qfile_exists_p);
+	  if (!NILP (handler) && !exec_only)
 	    {
 	      int exists;
 
 	      string = build_string (fn);
 
design & coding: Vladimir Lettiev aka crux © 2004-2005