Package: emacs22-common
Version: 22.1+1-2.3
Severity: normal

When using partial-complete-mode, trying to find a file, and providing
"<list>" as the filename should make emacs look for files named "list"
in the directories listed in PC-include-file-path but, instead of doing
that, emacs will look for files named "list.h". This happens because the
function PC-look-for-include-file will add an extra ".h" without even
trying to find the file first.

Steps to reproduce the bug:

1 - enable partial-complete-mode
2 - Add a directory containing a file without an extension in its name
to the list PC-include-file-path. (add-to-list 'PC-include-file-path
"/usr/include/c++/4.2") is enough if you have libstdc++6-4.2-dev
installed.
3 - Invoke find-file (C-x C-f) and type "<list>" as the name of file
to find.
4 - emacs will complain there is no header named "list.h" when it
should have loaded "/usr/include/c++/4.2/list"

Attached is a patch that will make it try to find the plain filename
or filename+".h" in each directory listed in PC-include-file-path and
load the first file found.


-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.24-1-686 (SMP w/1 CPU core)
Locale: LANG=pt_BR.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8) (ignored:
LC_ALL set to pt_BR.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages emacs22-common depends on:
ii  dpkg                          1.14.16.6  package maintenance system
for Deb
ii  emacsen-common                1.4.17     Common facilities for all
emacsen

emacs22-common recommends no packages.

-- no debconf information

-- 
Goedson Teixeira Paixao          http://mundolivre.wordpress.com/
Debian Project                   http://www.debian.org/
Jabber ID: [EMAIL PROTECTED]    http://www.jabber.org/

diff -ur emacs22-22.1+1/lisp/complete.el emacs22-22.1+1.new/lisp/complete.el
--- emacs22-22.1+1/lisp/complete.el	2007-04-15 11:51:28.000000000 -0300
+++ emacs22-22.1+1.new/lisp/complete.el	2008-03-04 12:50:49.000000000 -0300
@@ -1020,23 +1020,27 @@
 			  (or (string-match "\\.el$" name)
 			      (setq name (concat name ".el")))))
 		    (error "Not on an #include line"))))))
-	(or (string-match "\\.[[:alnum:]]+$" name)
-	    (setq name (concat name ".h")))
 	(if (eq punc ?\<)
 	    (let ((path (or path (PC-include-file-path))))
 	      (while (and path
-			  (not (file-exists-p
-				(concat (file-name-as-directory (car path))
-					name))))
-		(setq path (cdr path)))
+					  (not (or (file-exists-p
+								(concat (file-name-as-directory (car path))
+										name))
+							   (file-exists-p
+								(concat (file-name-as-directory (car path))
+										name ".h")))))
+			(setq path (cdr path)))
 	      (if path
-		  (setq name (concat (file-name-as-directory (car path)) name))
-		(error "No such include file: <%s>" name)))
+			  (if (file-exists-p
+				   (concat (file-name-as-directory (car path)) name))
+				  (setq name (concat (file-name-as-directory (car path)) name))
+				  (setq name (concat (file-name-as-directory (car path)) name ".h")))
+		  (error "No such include file: <%s>" name)))
 	  (let ((dir (with-current-buffer (car (buffer-list))
 		       default-directory)))
-	    (if (file-exists-p (concat dir name))
-		(setq name (concat dir name))
-	      (error "No such include file: `%s'" name))))
+		(if (file-exists-p (concat dir name))
+			(setq name (concat dir name))
+		  (error "No such include file: `%s'" name))))
 	(setq new-buf (get-file-buffer name))
 	(if new-buf
 	    ;; no need to verify last-modified time for this!
Only in emacs22-22.1+1.new/lisp: complete.el~

Attachment: signature.asc
Description: Esta é uma parte de mensagem assinada digitalmente

Reply via email to