bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5751: Strange behaviour of ff-find-other-file


From: Andrew Hyatt
Subject: bug#5751: Strange behaviour of ff-find-other-file
Date: Thu, 25 Aug 2016 00:16:02 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (darwin)

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 <arne.schmitz@gmx.net> 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:
> <help-echo> <help-echo> <down-mouse-1> <drag-mouse-1> 
> <down-mouse-1> <mouse-1> C-x C-f C-a C-k / . e m <tab> 
> . d <tab> i n i <tab> <return> <wheel-down> <double-wheel-down> 
> <triple-wheel-up> <triple-wheel-up> <triple-wheel-up> 
> <triple-wheel-up> <triple-wheel-up> <triple-wheel-up> 
> <triple-wheel-up> <wheel-down> <double-wheel-down> 
> <triple-wheel-down> <triple-wheel-down> <triple-wheel-down> 
> <triple-wheel-down> <wheel-down> <double-wheel-down> 
> <triple-wheel-down> <down-mouse-1> <mouse-1> C-a C-SPC 
> <down> <down> <down> <down> <up> <down> <down> <down> 
> M-w C-h f f i n d - o <tab> <tab> <tab> <backspace> 
> C-a C-k d <backspace> f f - f i <tab> o <tab> <return> 
> C-x o C-x 1 <down> <down> <down> <down> <down> <down> 
> <down> <down> <down> <down> <down> <down> <down> <down> 
> <next> <prior> <up> <up> <up> <up> <up> <up> <up> <up> 
> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
> <down> <down> <down> <down> <down> <down> <down> <down> 
> <down> <down> <down> <down> <down> <down> <down> <down> 
> <down> <down> <down> <down> <down> <down> <down> <down> 
> <down> <down> <down> <down> <down> <down> <down> <down> 
> <down> <down> <down> <down> <down> <down> <down> <down> 
> <down> <down> <down> <down> <down> <down> <up> <up> 
> <up> <up> <up> <up> <up> <up> <down> <down> <down> 
> <down> <down> <down> <down> <down> <down> <down> <down> 
> <down> <down> <down> <up> <up> <up> <up> <up> <up> 
> <down> <down> <down> <down> <down> <down> <down> <down> 
> <down> <down> <down> <down> <right> <left> <right> 
> <right> M-x r e p o r <tab> <return>
>
> 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]