unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
To: Leo <sdl.web@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Emacs 23 Mac port
Date: Fri, 30 Apr 2010 10:21:48 +0900	[thread overview]
Message-ID: <wl39ydwx8z.wl%mituharu@math.s.chiba-u.ac.jp> (raw)
In-Reply-To: <xbaioch4hs44.fsf@cam.ac.uk>

>>>>> On Wed, 28 Apr 2010 09:57:15 +0100, Leo <sdl.web@gmail.com> said:

> I sometimes run into alias files in dired and emacs treat them like
> a normal file. Do you think this can be fixed? Thank you.

Perhaps do-applescript can be used for resolving an alias file like:

(do-applescript "tell application \"Finder\" to get POSIX path of (the
 original item of (the POSIX file \"SOME_ALIAS_FILE\" as alias) as alias)")

but this requires quoting and unquoting file name strings.

I'll add `mac-file-alias-p', which is supposed to be parallel to
`file-symlink-p', to the next release.  This would enable you to
advise some dired function, I guess.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

=== modified file 'src/mac.c'
*** src/mac.c	2010-04-15 00:55:57 +0000
--- src/mac.c	2010-04-29 03:18:20 +0000
***************
*** 1826,1831 ****
--- 1826,1833 ----
  }
  
  \f
+ Lisp_Object Qmac_file_alias_p;
+ 
  void
  initialize_applescript ()
  {
***************
*** 2044,2049 ****
--- 2046,2103 ----
    return Qt;
  }
  
+ DEFUN ("mac-file-alias-p", Fmac_file_alias_p, Smac_file_alias_p, 1, 1, 0,
+        doc: /* Return non-nil if file FILENAME is the name of an alias file.
+ The value is the file referred to by the alias file, as a string.
+ Otherwise it returns nil.
+ 
+ This function returns t when given the name of an alias file
+ containing a unresolvable alias.  */)
+      (filename)
+      Lisp_Object filename;
+ {
+   OSStatus err;
+   Lisp_Object handler, result = Qnil;
+   FSRef fref;
+ 
+   CHECK_STRING (filename);
+   filename = Fexpand_file_name (filename, Qnil);
+ 
+   /* If the file name has special constructs in it,
+      call the corresponding file handler.  */
+   handler = Ffind_file_name_handler (filename, Qmac_file_alias_p);
+   if (!NILP (handler))
+     return call2 (handler, Qmac_file_alias_p, filename);
+ 
+   BLOCK_INPUT;
+   err = FSPathMakeRef (SDATA (ENCODE_FILE (filename)), &fref, NULL);
+   if (err == noErr)
+     {
+       Boolean alias_p = false, folder_p;
+ 
+       err = FSResolveAliasFileWithMountFlags (&fref, false,
+ 					      &folder_p, &alias_p,
+ 					      kResolveAliasFileNoUI);
+       if (err != noErr)
+ 	result = Qt;
+       else if (alias_p)
+ 	{
+ 	  char buf[MAXPATHLEN];
+ 
+ 	  err = FSRefMakePath (&fref, buf, sizeof (buf));
+ 	  if (err == noErr)
+ 	    {
+ 	      result = make_unibyte_string (buf, strlen (buf));
+ 	      if (buf[0] == '/' && index (buf, ':'))
+ 		result = concat2 (build_string ("/:"), result);
+ 	      result = DECODE_FILE (result);
+ 	    }
+ 	}
+     }
+   UNBLOCK_INPUT;
+ 
+   return result;
+ }
  
  /* Moving files to the system recycle bin.
     Used by `move-file-to-trash' instead of the default moving to ~/.Trash  */
***************
*** 3790,3795 ****
--- 3844,3852 ----
    Qdictionary = intern_c_string ("dictionary");	staticpro (&Qdictionary);
    Qdescription = intern_c_string ("description"); staticpro (&Qdescription);
  
+   Qmac_file_alias_p = intern_c_string ("mac-file-alias-p");
+   staticpro (&Qmac_file_alias_p);
+ 
    Qxml = intern_c_string ("xml");
    staticpro (&Qxml);
  
***************
*** 3823,3828 ****
--- 3880,3886 ----
    defsubr (&Smac_set_file_type);
    defsubr (&Smac_get_file_creator);
    defsubr (&Smac_get_file_type);
+   defsubr (&Smac_file_alias_p);
    defsubr (&Ssystem_move_file_to_trash);
    defsubr (&Sdo_applescript);
  





  reply	other threads:[~2010-04-30  1:21 UTC|newest]

Thread overview: 154+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-20 11:02 Carbon: resizing a frame on wrong "space" David Reitter
2008-02-21  1:13 ` YAMAMOTO Mitsuharu
2008-02-28 20:26   ` Harald Maier
2008-02-29  0:15     ` YAMAMOTO Mitsuharu
2008-02-29  2:40       ` William Xu
2008-02-29  3:02         ` YAMAMOTO Mitsuharu
2008-02-29  3:10           ` William Xu
2008-02-29  3:18             ` YAMAMOTO Mitsuharu
2008-02-29  4:55           ` Dan Nicolaescu
2008-02-29  8:36             ` YAMAMOTO Mitsuharu
2008-03-02  4:44               ` Stefan Monnier
2008-09-07  3:46         ` YAMAMOTO Mitsuharu
2008-11-27 11:37           ` YAMAMOTO Mitsuharu
2009-01-26  4:48             ` YAMAMOTO Mitsuharu
2009-03-27  0:28               ` YAMAMOTO Mitsuharu
2009-05-13  3:25                 ` YAMAMOTO Mitsuharu
2009-06-27  5:58                   ` Emacs 22 Carbon+AppKit port (was Re: Carbon: resizing a frame on wrong "space") YAMAMOTO Mitsuharu
2009-08-03  2:55                     ` Emacs 22 Carbon+AppKit port YAMAMOTO Mitsuharu
2009-08-07 20:41                       ` CHENG Gao
2009-08-29  0:48                       ` YAMAMOTO Mitsuharu
2009-08-31 17:38                         ` Benjamin Riefenstahl
2009-09-01  5:40                           ` YAMAMOTO Mitsuharu
2009-09-05  2:18                         ` Emacs 22 Carbon+AppKit port and Emacs 23 Mac port YAMAMOTO Mitsuharu
2009-09-05  7:47                           ` CHENG Gao
2009-09-05  8:56                             ` YAMAMOTO Mitsuharu
2009-09-05 11:27                               ` CHENG Gao
2009-09-05 12:15                             ` David Reitter
2009-09-05 12:42                               ` Stephen J. Turnbull
2009-09-05 14:35                               ` CHENG Gao
2009-09-05 17:28                                 ` David Reitter
2009-09-08 18:45                                   ` David Reitter
2009-09-08 16:22                             ` Stefan Monnier
2009-09-09  0:26                               ` YAMAMOTO Mitsuharu
2009-09-05  8:03                           ` CHENG Gao
2009-09-08 10:38                             ` CHENG Gao
2009-09-09  1:04                               ` YAMAMOTO Mitsuharu
2009-09-10 10:16                           ` YAMAMOTO Mitsuharu
2009-09-11 18:11                           ` CHENG Gao
2009-09-27  4:23                           ` YAMAMOTO Mitsuharu
2009-11-01  4:47                             ` YAMAMOTO Mitsuharu
2009-12-09 22:08                               ` YAMAMOTO Mitsuharu
2009-12-31 11:46                                 ` YAMAMOTO Mitsuharu
2010-01-02  1:27                                   ` Leo
2010-01-02  4:21                                     ` YAMAMOTO Mitsuharu
2010-01-02 10:19                                       ` Leo
2010-01-02 15:26                                         ` Leo
2010-01-02 20:56                                   ` Leo
2010-01-03  2:45                                     ` YAMAMOTO Mitsuharu
2010-01-03 11:07                                       ` Leo
2010-01-12  8:16                                       ` Jan Djärv
2010-01-12  9:03                                         ` YAMAMOTO Mitsuharu
2010-01-12  9:28                                           ` Jan Djärv
2010-01-12 10:18                                             ` YAMAMOTO Mitsuharu
2010-01-12 14:15                                           ` Stefan Monnier
2010-01-12 17:21                                             ` Jan Djärv
2010-01-12 21:22                                               ` Stefan Monnier
2010-01-13  7:39                                                 ` Jan D.
2010-01-13 14:38                                                   ` Stefan Monnier
2010-01-12 23:35                                             ` YAMAMOTO Mitsuharu
2010-01-13  7:43                                               ` Jan D.
2010-01-04  2:08                                     ` Stefan Monnier
2010-01-30  4:42                                   ` YAMAMOTO Mitsuharu
2010-02-27  9:19                                     ` YAMAMOTO Mitsuharu
2010-04-03  2:26                                       ` YAMAMOTO Mitsuharu
2010-04-03 14:55                                         ` Leo
2010-04-03 16:07                                           ` Leo
2010-04-04  5:36                                           ` YAMAMOTO Mitsuharu
2010-04-06 13:09                                             ` Leo
2010-04-20  9:08                                         ` YAMAMOTO Mitsuharu
2010-04-20 13:07                                           ` Leo
2010-04-28  8:57                                           ` Leo
2010-04-30  1:21                                             ` YAMAMOTO Mitsuharu [this message]
2010-05-04  2:35                                           ` YAMAMOTO Mitsuharu
2010-05-04  3:10                                             ` Leo
2010-05-05  1:09                                               ` YAMAMOTO Mitsuharu
2010-05-05 15:58                                             ` David Reitter
2010-05-06  1:04                                               ` YAMAMOTO Mitsuharu
2010-05-06 16:34                                                 ` covici
2010-05-07  0:33                                                   ` YAMAMOTO Mitsuharu
2010-05-06 17:31                                                 ` David Reitter
2010-06-06 18:48                                                   ` John Higgins
2010-06-06 21:28                                                     ` David Reitter
2010-06-07  0:53                                                       ` YAMAMOTO Mitsuharu
2010-06-11 21:27                                                         ` Daniel Colascione
2010-11-16  1:25                                                         ` YAMAMOTO Mitsuharu
2010-11-16 14:11                                                           ` Ted Zlatanov
2010-11-17 13:44                                                             ` YAMAMOTO Mitsuharu
2010-11-17 14:57                                                               ` Ted Zlatanov
2010-11-17 17:00                                                                 ` David Reitter
2010-05-09  4:45                                             ` YAMAMOTO Mitsuharu
2010-05-29  8:14                                               ` YAMAMOTO Mitsuharu
2010-06-26  3:51                                                 ` YAMAMOTO Mitsuharu
2010-07-31  5:23                                                   ` YAMAMOTO Mitsuharu
2010-07-31 11:36                                                     ` covici
2010-08-05 19:15                                                     ` David Reitter
2010-09-27  8:38                                                     ` YAMAMOTO Mitsuharu
2010-09-27  9:24                                                       ` Leo
2010-11-10  8:50                                                       ` YAMAMOTO Mitsuharu
2010-11-14 21:47                                                         ` Daniel Colascione
2010-11-15  1:48                                                           ` Leo
2010-11-15  1:52                                                             ` covici
2010-11-15  7:03                                                           ` Chad Brown
2010-11-15 15:23                                                           ` Ted Zlatanov
2010-11-17 21:49                                                           ` ken manheimer
2010-11-18 14:35                                                             ` YAMAMOTO Mitsuharu
2010-12-01  3:34                                                         ` Leo
2010-12-01 10:43                                                           ` Leo
2010-12-02 10:01                                                             ` YAMAMOTO Mitsuharu
2010-12-02 14:52                                                               ` Leo
2010-12-03  4:41                                                                 ` YAMAMOTO Mitsuharu
2010-12-03  6:34                                                                   ` Leo
2010-12-12  4:41                                                         ` YAMAMOTO Mitsuharu
2011-01-15 10:35                                                           ` YAMAMOTO Mitsuharu
2011-02-01  9:40                                                             ` YAMAMOTO Mitsuharu
2011-02-15  8:04                                                               ` YAMAMOTO Mitsuharu
2011-03-10  6:29                                                                 ` YAMAMOTO Mitsuharu
2011-07-23  3:28                                                                   ` YAMAMOTO Mitsuharu
2011-07-26 11:07                                                                     ` YAMAMOTO Mitsuharu
2011-08-06  5:55                                                                     ` YAMAMOTO Mitsuharu
2011-08-06 11:48                                                                       ` Dimitri Fontaine
2011-08-06 13:00                                                                         ` Jan Djärv
2011-08-08  0:08                                                                           ` Alp Aker
2011-08-08  3:37                                                                             ` Stefan Monnier
2011-08-08  4:45                                                                             ` YAMAMOTO Mitsuharu
2011-08-08  9:48                                                                             ` Jan Djärv
2011-08-08 13:02                                                                               ` David Reitter
2011-08-08 16:14                                                                                 ` Jan Djärv
2011-08-08 12:59                                                                             ` David Reitter
2011-08-12 16:57                                                                             ` Dimitri Fontaine
2011-08-27  0:52                                                                       ` YAMAMOTO Mitsuharu
2011-09-01  0:42                                                                         ` YAMAMOTO Mitsuharu
2011-10-02 12:30                                                                           ` YAMAMOTO Mitsuharu
2011-10-06 19:08                                                                             ` Lars Magne Ingebrigtsen
2011-10-07  0:27                                                                               ` YAMAMOTO Mitsuharu
2011-10-07 10:25                                                                                 ` Lars Magne Ingebrigtsen
2011-10-17  1:29                                                                             ` YAMAMOTO Mitsuharu
2011-10-27  2:46                                                                         ` YAMAMOTO Mitsuharu
2011-11-28 10:45                                                                           ` YAMAMOTO Mitsuharu
2011-11-28 12:06                                                                             ` Carsten Mattner
2011-11-29 18:51                                                                               ` Jan Djärv
2011-11-28 14:58                                                                             ` Xu Xin
2012-01-15  6:07                                                                             ` YAMAMOTO Mitsuharu
2012-01-15 17:29                                                                               ` Xu Xin
2012-01-31  6:52                                                                               ` YAMAMOTO Mitsuharu
2012-01-31 15:57                                                                                 ` Xu Xin
2012-01-31 19:01                                                                                   ` John Wiegley
2010-03-13  0:16                               ` Emacs 22 Carbon+AppKit port and " YAMAMOTO Mitsuharu
2010-03-15 18:12                                 ` Giovanni Lanzani
2010-03-16  0:23                                   ` YAMAMOTO Mitsuharu
  -- strict thread matches above, loose matches on Subject: below --
2012-01-16 11:32 emacs user
2012-01-16 13:01 ` Leo
2012-01-17  0:49 ` YAMAMOTO Mitsuharu
2012-01-17  3:47 ` YAMAMOTO Mitsuharu
2012-01-17 10:51   ` YAMAMOTO Mitsuharu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=wl39ydwx8z.wl%mituharu@math.s.chiba-u.ac.jp \
    --to=mituharu@math.s.chiba-u.ac.jp \
    --cc=emacs-devel@gnu.org \
    --cc=sdl.web@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).