From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Arne Schmitz Newsgroups: gmane.emacs.bugs Subject: bug#5751: Strange behaviour of ff-find-other-file Date: Sun, 21 Mar 2010 20:21:21 +0100 Message-ID: <7B99D88E-806D-412D-8CCD-0EDB6CDF6588@gmx.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1269201324 19540 80.91.229.12 (21 Mar 2010 19:55:24 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 21 Mar 2010 19:55:24 +0000 (UTC) To: 5751@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 21 20:55:19 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NtRF1-0008Dn-9I for geb-bug-gnu-emacs@m.gmane.org; Sun, 21 Mar 2010 20:55:19 +0100 Original-Received: from localhost ([127.0.0.1]:43713 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtRF0-0003QF-PG for geb-bug-gnu-emacs@m.gmane.org; Sun, 21 Mar 2010 15:55:18 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NtREv-0003Ow-K8 for bug-gnu-emacs@gnu.org; Sun, 21 Mar 2010 15:55:13 -0400 Original-Received: from [140.186.70.92] (port=35718 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtREr-0003KZ-75 for bug-gnu-emacs@gnu.org; Sun, 21 Mar 2010 15:55:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NtREp-00025Y-KK for bug-gnu-emacs@gnu.org; Sun, 21 Mar 2010 15:55:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41659) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NtREp-00025T-F2 for bug-gnu-emacs@gnu.org; Sun, 21 Mar 2010 15:55:07 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1NtREk-00041C-0U; Sun, 21 Mar 2010 15:55:02 -0400 X-Loop: bug-gnu-emacs@gnu.org Resent-From: Arne Schmitz Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 21 Mar 2010 19:55:01 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-GNU-PR-Message: report 5751 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.126920126315433 (code B ref -1); Sun, 21 Mar 2010 19:55:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Mar 2010 19:54:23 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NtRE6-00040s-5G for submit@debbugs.gnu.org; Sun, 21 Mar 2010 15:54:22 -0400 Original-Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NtQj5-0003oM-Rf for submit@debbugs.gnu.org; Sun, 21 Mar 2010 15:22:21 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:50513) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NtQj1-0006s9-9u for submit@debbugs.gnu.org; Sun, 21 Mar 2010 15:22:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NtQj0-0005Jv-SH for bug-gnu-emacs@gnu.org; Sun, 21 Mar 2010 15:22:14 -0400 Original-Received: from [140.186.70.92] (port=55332 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtQiz-0005IY-3U for bug-gnu-emacs@gnu.org; Sun, 21 Mar 2010 15:22:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NtQiJ-0007Uu-6b for bug-gnu-emacs@gnu.org; Sun, 21 Mar 2010 15:21:33 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]:46445) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1NtQiI-0007UO-RE for bug-gnu-emacs@gnu.org; Sun, 21 Mar 2010 15:21:31 -0400 Original-Received: (qmail invoked by alias); 21 Mar 2010 19:21:24 -0000 Original-Received: from xdsl-78-35-153-101.netcologne.de (EHLO [192.168.2.104]) [78.35.153.101] by mail.gmx.net (mp007) with SMTP; 21 Mar 2010 20:21:24 +0100 X-Authenticated: #2146970 X-Provags-ID: V01U2FsdGVkX18WvL0bI7wW5GEzXGY7N2cQ09clNw3hsK5zpPWxzC zoxiJ4ux6ELEB6 X-Mailer: Apple Mail (2.1077) X-Y-GMX-Trusted: 0 X-FuHaFi: 0.48999999999999999 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Mailman-Approved-At: Sun, 21 Mar 2010 15:54:20 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 21 Mar 2010 15:55:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:35683 Archived-At: Hi everyone! I have found a behaviour in ff-find-other-file that I would consider a bug. However, I am not sure if this is definitely the case, but at least I would say that the function's behaviour does not correspond to it's implementation. The documentation says: "Find the header or source file corresponding to this file." Consider the following: the header and source for a certain case are already being visited. Let's say the source is in $CWD/project-src/foo.c, and the header in $CWD/include/foo.h. If either ../project-src or ../include is not in the ff-search-directories, the appropriate switch to the source or header file will fail. Consider that this will also fail, if the corresponding file is already being visited! This is not explicitly demanded by the documentation, but would be useful behaviour in my opinion. Looking at the source for ff-find-other-file leads to these lines in the function ff-get-file-name: (if (bufferp (get-file-buffer filename)) (setq found (buffer-file-name (get-file-buffer filename)))) To my understanding this is supposed to search through the current buffers for the corresponding file. However, this seems to always fail, since the variable filename is not expanded, as get-file-buffer demands, and neither do I see how this is supposed to happen anyway. So in the least, this code is useless, or worst, broken. Since I like to have Emacs find the file, if there is a buffer visiting a file with the correct name (although it might not be unique), I changed the above lines to the following: (let ((b (find-if (lambda(x) (string=3D (buffer-name x) filename)) = (buffer-list)))) (if b (setq found (buffer-file-name b)))) Not sure, if this is the best code to achieve this, since I don't know Emacs-Lisp very well, and a friend helped me figure this out. Hope this helps and best regards, Arne In GNU Emacs 22.3.1 (i386-apple-darwin9.8.0, Carbon Version 1.6.0) of 2010-01-10 on gs674-seijiz.local Windowing system distributor `Apple Inc.', version 10.6.2 configured using `configure = '--prefix=3D/Applications/Emacs.app/Contents/Resources' '--with-carbon' = '--without-x' = '--libexecdir=3D/Volumes/Emacs/Emacs.app/Contents/MacOS/libexec' = 'CC=3Dgcc-4.2' 'CFLAGS=3D-O2 -arch i386 -arch ppc7400 -DUSE_ATSUI = -DUSE_MAC_TSM'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: nil locale-coding-system: iso-latin-1 default-enable-multibyte-characters: t Major mode: Help Minor modes in effect: show-paren-mode: t server-mode: t desktop-save-mode: t ecb-minor-mode: t tabbar-mwheel-mode: t tabbar-mode: t which-function-mode: t mac-print-mode: t tooltip-mode: t tool-bar-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t unify-8859-on-encoding-mode: t utf-translate-cjk-mode: t auto-compression-mode: t temp-buffer-resize-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t view-mode: t Recent input: =20 C-x C-f C-a C-k / . e m =20 . d i n i =20 =20 =20 =20 =20 =20 C-a C-SPC=20 =20 M-w C-h f f i n d - o =20 C-a C-k d f f - f i o =20 C-x o C-x 1 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 M-x r e p o r Recent messages: Showing all blocks ... done [3 times] Showing all blocks ... done [2 times] Loading semantic-tag-write...done Mark saved where search started Mark set Type C-x 4 C-o RET to restore the other window. =20 Loading eieio-opt...done call-interactively: End of buffer [2 times] Loading emacsbug...done Loading dabbrev...done --=20 Dipl.-Inform. Arne Schmitz Phone +49 (0)241 80-21817 Computer Graphics Group Mobile +49 (0)151 29145947 RWTH Aachen University Fax +49 (0)241 80-22899 Ahornstrasse 55, 52074 Aachen, Germany http://www.rwth-graphics.de