Re: proxy icon and moved files

2006-08-22 Thread YAMAMOTO Mitsuharu
> On Mon, 21 Aug 2006 16:27:58 +0100, David Reitter <[EMAIL PROTECTED]> 
> said:

> Dragging and dropping the Carbon proxy icon to a Finder window
> sometimes saves the backup file (foo.txt~) instead of the actual
> file.

> I could reproduce this with a current build. I tried to locate the
> code that handles these things, but it's not immediately evident why
> a local copy of the file name for the frame is kept in macterm.c
> (file_name) and why it isn't updated correctly (if that is the
> cause).

The intended reason why a local copy is kept is to avoid needless data
conversion and display update as much as possible.  And the local copy
itself is updated correctly.

The proxy icon is set by giving the corresponding alias record to
SetWindowProxyAlias.  But the correspondence between file name and
alias record seems to be not persistent.  Actually, the latter takes
care of renaming.

Could you try the following patch?  It tries to see if the alias
record that is currently set is updated by the current file name.

 YAMAMOTO Mitsuharu
[EMAIL PROTECTED]

Index: src/macfns.c
===
RCS file: /cvsroot/emacs/emacs/src/macfns.c,v
retrieving revision 1.90
diff -c -p -r1.90 macfns.c
*** src/macfns.c28 Jun 2006 08:30:16 -  1.90
--- src/macfns.c22 Aug 2006 05:35:29 -
*** static void
*** 1945,2007 
  mac_update_proxy_icon (f)
   struct frame *f;
  {
Lisp_Object file_name =
  XBUFFER (XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer)->filename;
Window w = FRAME_MAC_WINDOW (f);
! 
!   if (FRAME_FILE_NAME (f) == NULL && !STRINGP (file_name))
! return;
!   if (FRAME_FILE_NAME (f) && STRINGP (file_name)
!   && strcmp (FRAME_FILE_NAME (f), SDATA (file_name)) == 0)
! return;
! 
!   if (FRAME_FILE_NAME (f))
! {
!   xfree (FRAME_FILE_NAME (f));
!   FRAME_FILE_NAME (f) = NULL;
! }
  
BLOCK_INPUT;
  
if (STRINGP (file_name))
  {
-   OSStatus err;
AEDesc desc;
Lisp_Object encoded_file_name = ENCODE_FILE (file_name);
  
! #ifdef MAC_OS8
SetPortWindowPort (w);
- #endif
err = AECoercePtr (TYPE_FILE_NAME, SDATA (encoded_file_name),
!SBYTES (encoded_file_name), typeAlias, &desc);
if (err == noErr)
{
! Size size = AEGetDescDataSize (&desc);
! AliasHandle alias = (AliasHandle) NewHandle (size);
! 
! if (alias == NULL)
!   err = memFullErr;
! else
!   {
! HLock ((Handle) alias);
! err = AEGetDescData (&desc, *alias, size);
! HUnlock ((Handle) alias);
! if (err == noErr)
!   err = SetWindowProxyAlias (w, alias);
! DisposeHandle ((Handle) alias);
!   }
  AEDisposeDesc (&desc);
}
if (err == noErr)
{
! FRAME_FILE_NAME (f) = xmalloc (SBYTES (file_name) + 1);
! strcpy (FRAME_FILE_NAME (f), SDATA (file_name));
}
  }
  
!   if (FRAME_FILE_NAME (f) == NULL)
  RemoveWindowProxy (w);
  
UNBLOCK_INPUT;
  }
  #endif
--- 1945,2024 
  mac_update_proxy_icon (f)
   struct frame *f;
  {
+   OSStatus err;
Lisp_Object file_name =
  XBUFFER (XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer)->filename;
Window w = FRAME_MAC_WINDOW (f);
!   AliasHandle alias = NULL;
  
BLOCK_INPUT;
  
+   err = GetWindowProxyAlias (w, &alias);
+   if (err == errWindowDoesNotHaveProxy && !STRINGP (file_name))
+ goto out;
+ 
if (STRINGP (file_name))
  {
AEDesc desc;
+ #ifdef MAC_OSX
+   FSRef fref;
+ #else
+   FSSpec fss;
+ #endif
+   Boolean changed;
Lisp_Object encoded_file_name = ENCODE_FILE (file_name);
  
! #ifdef MAC_OSX
!   err = AECoercePtr (TYPE_FILE_NAME, SDATA (encoded_file_name),
!SBYTES (encoded_file_name), typeFSRef, &desc);
! #else
SetPortWindowPort (w);
err = AECoercePtr (TYPE_FILE_NAME, SDATA (encoded_file_name),
!SBYTES (encoded_file_name), typeFSS, &desc);
! #endif
if (err == noErr)
{
! #ifdef MAC_OSX
! err = AEGetDescData (&desc, &fref, sizeof (FSRef));
! #else
! err = AEGetDescData (&desc, &fss, sizeof (FSSpec));
! #endif
  AEDisposeDesc (&desc);
}
if (err == noErr)
{
! if (alias)
!   {
! #ifdef MAC_OSX
! err = FSUpdateAlias (NULL, &fref, alias, &changed);
! #else
! err = UpdateAlias (NULL, &fss, alias, &changed);
! #endif
!   }
! if (err != noErr || alias == NULL)
!   {
! if (alias)
!   DisposeHandle ((Handle) alias);
! #ifdef MAC_OSX
! err = FSNewAliasMinimal (&fref, &alias);
! #else
! err = NewAliasMinimal (&fss, &alias);
! #endif
! changed = true;
! 

Re: [PATCH] another possible behavior for ido-enter-matching-directory

2006-08-22 Thread Kim F. Storm
"Matthieu Moy" <[EMAIL PROTECTED]> writes:

> Hi,
>
> We had a discussion a few months ago about the behavior of ido when
> one types a slash.
>
> I'm still not satisfied by the current bevavior. In particular, I
> often have directories like:
>
> ./XXX/
> ./XXX-aaa/
> ./XXX-bbb/
> ./XXX-ccc/
>
> Then, at the prompt, I get
>
> ./XXX/{XXX-aaa,XXX-bbb,XXX-ccc,XXX}
>
> and I have no "fast" way to open XXX itself, while it would have been
> trivial to open it without ido.

I have just installed a change so that when there is an exact
match, ido puts it first in the list, so you can easily select it
with RET:

> ./XXX/{XXX,XXX-aaa,XXX-bbb,XXX-ccc}

As an added bonus, ido now does suffix-matching on directories, so
to select XXX/ above, all you need to enter now is  X/ as that's
the only directory ending in an X.  You can select the other
directories with a/, b/ and c/.

> I propose a new possible value for ido-enter-matching-directory, which
> enters the directory when there is an exact match, whether or not it's
> the first. 

With the above change 'first ==> 'exact.

-- 
Kim F. Storm <[EMAIL PROTECTED]> http://www.cua.dk



___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: [PATCH] another possible behavior for ido-enter-matching-directory

2006-08-22 Thread Matthieu Moy
[EMAIL PROTECTED] (Kim F. Storm) writes:

> I have just installed a change so that when there is an exact
> match, ido puts it first in the list, so you can easily select it
> with RET:

Seems to be an even more clever way to solve the problem I
reported :-).

Thanks,

-- 
Matthieu


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Key descriptions in *Help* are too wide

2006-08-22 Thread Drew Adams
I bind down-mouse-2 to `ignore' and `mouse-2' to another
command. Because there are lots of keys bound to `ignore', when I do
C-h k mouse-2, I get a key description that is far too wide: 148
characters on a single line!  For example:

 at that spot runs the command ignore
   which is an interactive compiled Lisp function in `subr.el'.
It is bound to , , , ,
, , , , .
(ignore &rest IGNORE)

The *Help* buffer description should be filled. This is important, for
example, for code that automatically fits frames to their buffer size
(e.g. max line width).


In GNU Emacs 22.0.50.1 (i386-msvc-nt5.1.2600)
 of 2006-07-19 on BOS-CTHEWLAP2
X server distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-msvc (12.00)'

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: ENU
  locale-coding-system: cp1252
  default-enable-multibyte-characters: t

Major mode: Dired by name

Minor modes in effect:
  encoded-kbd-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
  line-number-mode: t

Recent input:

   

Recent messages:
(C:\Emacs-22-2006-07-19-Fran\bin\emacs.exe -q --no-site-file --debug-init
C:\drews-lisp-20)
Loading encoded-kb...done
For information about the GNU Project and its goals, type C-h C-p.
Loading dired...
Loading regexp-opt...done
Loading dired...done
Loading emacsbug...done



___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug