From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andrew Hyatt Newsgroups: gmane.emacs.bugs Subject: bug#5751: Strange behaviour of ff-find-other-file Date: Thu, 25 Aug 2016 00:16:02 -0400 Message-ID: References: <7B99D88E-806D-412D-8CCD-0EDB6CDF6588@gmx.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1472098644 22624 195.159.176.226 (25 Aug 2016 04:17:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 25 Aug 2016 04:17:24 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (darwin) Cc: 5751@debbugs.gnu.org To: Arne Schmitz Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 25 06:17:20 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bcm6R-0005Ng-Gg for geb-bug-gnu-emacs@m.gmane.org; Thu, 25 Aug 2016 06:17:20 +0200 Original-Received: from localhost ([::1]:54397 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcm6S-0002Oq-61 for geb-bug-gnu-emacs@m.gmane.org; Thu, 25 Aug 2016 00:17:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcm6I-0002NW-8D for bug-gnu-emacs@gnu.org; Thu, 25 Aug 2016 00:17:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bcm6A-0002dE-Gz for bug-gnu-emacs@gnu.org; Thu, 25 Aug 2016 00:17:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42040) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcm6A-0002dA-DA for bug-gnu-emacs@gnu.org; Thu, 25 Aug 2016 00:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bcm6A-0006Lx-93 for bug-gnu-emacs@gnu.org; Thu, 25 Aug 2016 00:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrew Hyatt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 25 Aug 2016 04:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 5751 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 5751-submit@debbugs.gnu.org id=B5751.147209857623038 (code B ref 5751); Thu, 25 Aug 2016 04:17:02 +0000 Original-Received: (at 5751) by debbugs.gnu.org; 25 Aug 2016 04:16:16 +0000 Original-Received: from localhost ([127.0.0.1]:39749 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bcm5P-0005z6-Fy for submit@debbugs.gnu.org; Thu, 25 Aug 2016 00:16:16 -0400 Original-Received: from mail-qk0-f179.google.com ([209.85.220.179]:34353) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bcm5M-0005qk-0u for 5751@debbugs.gnu.org; Thu, 25 Aug 2016 00:16:14 -0400 Original-Received: by mail-qk0-f179.google.com with SMTP id t7so35406057qkh.1 for <5751@debbugs.gnu.org>; Wed, 24 Aug 2016 21:16:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=cMbxJMR6rmPYDcNPPQltcdt352Wa1PwAdT9OD8d3AQw=; b=tswoDxa9jr1k5uZjvqpHN3EnsYFJJusCgNIM1efCqLu/fgSY4kNp7EsXfH2s5EUglx qEDvBpJGtocTWdoswGwrWxrhagMxk2anf1AhH6S7wFYQwX7KaJgvRBniwiQKhuaruvLf j3VZ/IUVoeHcg5OlUCzZPwbUPuAsky/qYuTwaF9a+Z/Lf4Id3JVmSu4YwT+U2UMTNp7z agPfleydHQ35XmI6FCmnxtUbv9/AyI9pG9gOxCB0mf15Io6Y7GE3CmGTRun65+utvrhJ 5pskIb+e4MZgqpoABKhDyVOqMYgea2QgjBXT3B7iAPAom+/kgAR6TIpThpQFIbssHd+r Zkmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=cMbxJMR6rmPYDcNPPQltcdt352Wa1PwAdT9OD8d3AQw=; b=DOYsmAxdp1adfYQt8DXZ/PQlcQMddSOjYLbMhCQwSCT4TQPv1sx/4+ztwcjo7i/ESG Pc0ReiCjzslEtJIpBFWr2PY8Muz9E4vzyShNBvOq1Wx8A1YMnWGoz4RLqxppwDr+R1Oz o5bbGgDGcS9r/xI4/IwSf2Lr/a/WPJaOdw0Bisj50o2jVcQkIklge+Jt9RnT7W8cXCCt dJrga8ljQvY6ZCn3fNZDY2QDgd0CCcbmF4pgitgG1YMr4a6Nk5lDwCH/kXNZYoKxQLx0 K2vruAEQFEgLUqyyO9r9ulji4W+NYC5SEEYdtf0/Ewn2yCTWP8+maO52nNPmE3zpGNqQ 3OPA== X-Gm-Message-State: AE9vXwO86wtYQwID7Mx56W+W1rJn4GIo4Mv1xeiEJDXuAj6d6HuAh62hsfv3hNgr8lDPVg== X-Received: by 10.55.74.14 with SMTP id x14mr7546408qka.102.1472098566176; Wed, 24 Aug 2016 21:16:06 -0700 (PDT) Original-Received: from Andrews-MacBook-Pro.local (cpe-74-73-128-199.nyc.res.rr.com. [74.73.128.199]) by smtp.gmail.com with ESMTPSA id d12sm6597146qkc.19.2016.08.24.21.16.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Aug 2016 21:16:03 -0700 (PDT) In-Reply-To: <7B99D88E-806D-412D-8CCD-0EDB6CDF6588@gmx.net> (Arne Schmitz's message of "Sun, 21 Mar 2010 20:21:21 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:122621 Archived-At: Sorry for the delay in response here. I think I understand what you are saying, but I think we probably would both agree this is more of a feature request than a bug. But I'm not sure it makes sense as a feature request - just because you have foo.c and foo.h, it is dangerous to think they are related just because they both exist as buffers. I frequently have multiple copies of the same file open in different directories to work on different issues - it would be a bug if ff-find-other-file started flipping between two very different working directories. So, I'm closing this one as not a bug. Arne Schmitz writes: > 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= (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=/Applications/Emacs.app/Contents/Resources' '--with-carbon' '--without-x' '--libexecdir=/Volumes/Emacs/Emacs.app/Contents/MacOS/libexec' 'CC=gcc-4.2' 'CFLAGS=-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: > > C-x C-f C-a C-k / . e m > . d i n i > > > > > > C-a C-SPC > > M-w C-h f f i n d - o > C-a C-k d f f - f i o > C-x o C-x 1 > > > > > > > > > > > > > > > > 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. > Loading eieio-opt...done > call-interactively: End of buffer [2 times] > Loading emacsbug...done > Loading dabbrev...done