* Re: Bug#469486: emacs22-common: partial-complete adds ".h" to filename without trying the plain input first
[not found] <1204726142.22737.10.camel@framps>
@ 2008-03-05 17:10 ` Sven Joachim
2008-03-05 17:35 ` Chong Yidong
0 siblings, 1 reply; 3+ messages in thread
From: Sven Joachim @ 2008-03-05 17:10 UTC (permalink / raw)
To: emacs-devel; +Cc: 469486-forwarded, Goedson Teixeira Paixao
I received the following report via the Debian bug tracking system.
The patch needs to be reindented, but seems to be correct, AFAICS.
On 2008-03-05 15:09 +0100, Goedson Teixeira Paixao wrote:
> 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: goedson@jabber.org 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!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Bug#469486: emacs22-common: partial-complete adds ".h" to filename without trying the plain input first
2008-03-05 17:10 ` Bug#469486: emacs22-common: partial-complete adds ".h" to filename without trying the plain input first Sven Joachim
@ 2008-03-05 17:35 ` Chong Yidong
2008-03-05 18:36 ` Goedson Teixeira Paixao
0 siblings, 1 reply; 3+ messages in thread
From: Chong Yidong @ 2008-03-05 17:35 UTC (permalink / raw)
To: Sven Joachim; +Cc: emacs-devel, Goedson Teixeira Paixao, 469486
Sven Joachim <svenjoac@gmx.de> writes:
>> 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"
This is ambiguous, because the docstring for PC-include-file-path says
A list of directories in which to look for include files.
This seems to imply that PC-include-file-path won't be searched for
files that aren't explicitly include files. However, I don't use
partial-completion-mode, so I'd like the opinions of those who do use
it. (If the users agree with this change, we can add it to the branch
after 22.2 is released.)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Bug#469486: emacs22-common: partial-complete adds ".h" to filename without trying the plain input first
2008-03-05 17:35 ` Chong Yidong
@ 2008-03-05 18:36 ` Goedson Teixeira Paixao
0 siblings, 0 replies; 3+ messages in thread
From: Goedson Teixeira Paixao @ 2008-03-05 18:36 UTC (permalink / raw)
To: Chong Yidong; +Cc: goedson, Sven Joachim, 469486, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1662 bytes --]
Em Qua, 2008-03-05 às 12:35 -0500, Chong Yidong escreveu:
> Sven Joachim <svenjoac@gmx.de> writes:
> >> 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"
>
> This is ambiguous, because the docstring for PC-include-file-path says
>
> A list of directories in which to look for include files.
>
> This seems to imply that PC-include-file-path won't be searched for
> files that aren't explicitly include files.
You're right. But we can't decide on what is or what is not an include
file based only in the filename extension. In the example cited above,
"list" is a perfectly legal include file from the C++ STL. And most of
the headers (if not all) from the Standard C++ library don't have names
ending in ".h".
> However, I don't use
> partial-completion-mode, so I'd like the opinions of those who do use
> it. (If the users agree with this change, we can add it to the branch
> after 22.2 is released.)
As you may guess by the name of the bug submiter, I'm in favor of this
change ;)
--
Goedson Teixeira Paixao http://mundolivre.wordpress.com/
Debian Project http://www.debian.org/
Jabber ID: goedson@jabber.org http://www.jabber.org/
[-- Attachment #2: Esta é uma parte de mensagem assinada digitalmente --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-05 18:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1204726142.22737.10.camel@framps>
2008-03-05 17:10 ` Bug#469486: emacs22-common: partial-complete adds ".h" to filename without trying the plain input first Sven Joachim
2008-03-05 17:35 ` Chong Yidong
2008-03-05 18:36 ` Goedson Teixeira Paixao
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).