unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Help me unlock a file while in emacs on the Mac
@ 2003-05-07 17:27 Susan G. Conger
  2003-05-07 18:17 ` Andrew Choi
  0 siblings, 1 reply; 6+ messages in thread
From: Susan G. Conger @ 2003-05-07 17:27 UTC (permalink / raw)


Hi,

I need help.  I am trying to figure out the best way to unlock the file 
I am currently editing in emacs on the Mac.  I need to have some type of 
lisp command I believe that calls the shell and execute a command.  I 
just don't know how to do this and it seems like it should be straight 
forward.

Thanks in advance for your help,
Susan

-- 
============================================================
Susan G. Conger       Custom Windows & Macintosh Development
President                      Web Site Design & Development
YOERIC Corporation             Database Design & Development
256 Windy Ridge Road
Chapel Hill, NC  27517
Phone/Fax: (919)542-0071
email:  congers@yoeric.com     Web:  www.yoeric.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help me unlock a file while in emacs on the Mac
  2003-05-07 17:27 Help me unlock a file while in emacs on the Mac Susan G. Conger
@ 2003-05-07 18:17 ` Andrew Choi
  2003-05-07 18:46   ` Susan G. Conger
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Choi @ 2003-05-07 18:17 UTC (permalink / raw)


"Susan G. Conger" <congers@yoeric.com> writes:

> I need help.  I am trying to figure out the best way to unlock the file 
> I am currently editing in emacs on the Mac.  I need to have some type of 
> lisp command I believe that calls the shell and execute a command.  I 
> just don't know how to do this and it seems like it should be straight 
> forward.

I assume you want to unlock files with lock flags set in the Finder.
For read-only files, just use toggle-read-only.

Define the following two functions.

  (defun mac-unlock-file (fn)
    (interactive "fUnlock file: ")
    (call-process "/usr/bin/chflags" nil t nil "nouchg" (expand-file-name fn)))

  (defun mac-unlock-current-file ()
    (interactive)
    (mac-unlock-file (buffer-file-name)))

Then you can bind mac-unlock-current-file to a key (please see the
manual for how to do this) or just call it by typing M-x
mac-unlock-current-file.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help me unlock a file while in emacs on the Mac
  2003-05-07 18:17 ` Andrew Choi
@ 2003-05-07 18:46   ` Susan G. Conger
  2003-05-07 19:23     ` Andrew Choi
  0 siblings, 1 reply; 6+ messages in thread
From: Susan G. Conger @ 2003-05-07 18:46 UTC (permalink / raw)


Andrew,

Thank you so much.  I have a couple of question.  I put these in my 
.emacs file and they work except for one small problem.  The file is 
really unlocked but the buffer thinks that it is still locked.  I tried 
doing a C-X C-F to reread the file but it still thought it was locked.  
How would I change the mac-unlock-file so that it realizes that it can 
now edit the buffer and be able to save the changes back to the file.  
Also, I tried to assign F7 to the mac-unlock-current-file, however I 
could not figure out how to get it to except just F7 as the command key.  
Here is the commands that I tried:

(global-set-key "^[[18~" 'mac-unlock-current-file)
(global-set-key "f7" 'mac-unlock-current-file)

Thanks again,
Susan

In article <m2ptmuiptm.fsf@owlbear.local>,
 Andrew Choi <akochoi_NOSPAM_@shaw.ca> wrote:

> "Susan G. Conger" <congers@yoeric.com> writes:
> 
> > I need help.  I am trying to figure out the best way to unlock the file 
> > I am currently editing in emacs on the Mac.  I need to have some type of 
> > lisp command I believe that calls the shell and execute a command.  I 
> > just don't know how to do this and it seems like it should be straight 
> > forward.
> 
> I assume you want to unlock files with lock flags set in the Finder.
> For read-only files, just use toggle-read-only.
> 
> Define the following two functions.
> 
>   (defun mac-unlock-file (fn)
>     (interactive "fUnlock file: ")
>     (call-process "/usr/bin/chflags" nil t nil "nouchg" (expand-file-name 
>     fn)))
> 
>   (defun mac-unlock-current-file ()
>     (interactive)
>     (mac-unlock-file (buffer-file-name)))
> 
> Then you can bind mac-unlock-current-file to a key (please see the
> manual for how to do this) or just call it by typing M-x
> mac-unlock-current-file.

-- 
============================================================
Susan G. Conger       Custom Windows & Macintosh Development
President                      Web Site Design & Development
YOERIC Corporation             Database Design & Development
256 Windy Ridge Road
Chapel Hill, NC  27517
Phone/Fax: (919)542-0071
email:  congers@yoeric.com     Web:  www.yoeric.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help me unlock a file while in emacs on the Mac
  2003-05-07 18:46   ` Susan G. Conger
@ 2003-05-07 19:23     ` Andrew Choi
  2003-05-07 19:31       ` Susan G. Conger
  2003-05-07 21:02       ` Kevin Rodgers
  0 siblings, 2 replies; 6+ messages in thread
From: Andrew Choi @ 2003-05-07 19:23 UTC (permalink / raw)


"Susan G. Conger" <congers@yoeric.com> writes:

> [...]  The file is really unlocked but the buffer thinks that it is
> still locked.  I tried doing a C-X C-F to reread the file but it still
> thought it was locked.  How would I change the mac-unlock-file so that
> it realizes that it can now edit the buffer and be able to save the
> changes back to the file.

Oops, I forgot.  You need to call toggle-read-only, or change
mac-unlock-current-file to call it for you.

   (defun mac-unlock-current-file ()
     (interactive)
     (mac-unlock-file (buffer-file-name))
     (toggle-read-only))

> Also, I tried to assign F7 to the mac-unlock-current-file, however I 
> could not figure out how to get it to except just F7 as the command key.  
> Here is the commands that I tried:
> 
> (global-set-key "^[[18~" 'mac-unlock-current-file)
> (global-set-key "f7" 'mac-unlock-current-file)

Please try:

  (global-set-key [f7] 'mac-unlock-current-file)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help me unlock a file while in emacs on the Mac
  2003-05-07 19:23     ` Andrew Choi
@ 2003-05-07 19:31       ` Susan G. Conger
  2003-05-07 21:02       ` Kevin Rodgers
  1 sibling, 0 replies; 6+ messages in thread
From: Susan G. Conger @ 2003-05-07 19:31 UTC (permalink / raw)


Andrew,

Thank you!  Thank you!  Thank you!  Thank you!  Thank you!  Thank you!

IT WORKS!  This has been bothering me for quite some time.

Thanks,
Susan

In article <m2of2ea7dj.fsf@owlbear.local>,
 Andrew Choi <akochoi_NOSPAM_@shaw.ca> wrote:

> "Susan G. Conger" <congers@yoeric.com> writes:
> 
> > [...]  The file is really unlocked but the buffer thinks that it is
> > still locked.  I tried doing a C-X C-F to reread the file but it still
> > thought it was locked.  How would I change the mac-unlock-file so that
> > it realizes that it can now edit the buffer and be able to save the
> > changes back to the file.
> 
> Oops, I forgot.  You need to call toggle-read-only, or change
> mac-unlock-current-file to call it for you.
> 
>    (defun mac-unlock-current-file ()
>      (interactive)
>      (mac-unlock-file (buffer-file-name))
>      (toggle-read-only))
> 
> > Also, I tried to assign F7 to the mac-unlock-current-file, however I 
> > could not figure out how to get it to except just F7 as the command key.  
> > Here is the commands that I tried:
> > 
> > (global-set-key "^[[18~" 'mac-unlock-current-file)
> > (global-set-key "f7" 'mac-unlock-current-file)
> 
> Please try:
> 
>   (global-set-key [f7] 'mac-unlock-current-file)

-- 
============================================================
Susan G. Conger       Custom Windows & Macintosh Development
President                      Web Site Design & Development
YOERIC Corporation             Database Design & Development
256 Windy Ridge Road
Chapel Hill, NC  27517
Phone/Fax: (919)542-0071
email:  congers@yoeric.com     Web:  www.yoeric.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help me unlock a file while in emacs on the Mac
  2003-05-07 19:23     ` Andrew Choi
  2003-05-07 19:31       ` Susan G. Conger
@ 2003-05-07 21:02       ` Kevin Rodgers
  1 sibling, 0 replies; 6+ messages in thread
From: Kevin Rodgers @ 2003-05-07 21:02 UTC (permalink / raw)


Andrew Choi wrote:

> "Susan G. Conger" <congers@yoeric.com> writes:
> 
> 
>>[...]  The file is really unlocked but the buffer thinks that it is
>>still locked.  I tried doing a C-X C-F to reread the file but it still
>>thought it was locked.  How would I change the mac-unlock-file so that
>>it realizes that it can now edit the buffer and be able to save the
>>changes back to the file.
>>
> 
> Oops, I forgot.  You need to call toggle-read-only, or change
> mac-unlock-current-file to call it for you.
> 
>    (defun mac-unlock-current-file ()
>      (interactive)
>      (mac-unlock-file (buffer-file-name))
>      (toggle-read-only))

Wouldn't revert-buffer be more reliable than toggle-read-only?

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-05-07 21:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-07 17:27 Help me unlock a file while in emacs on the Mac Susan G. Conger
2003-05-07 18:17 ` Andrew Choi
2003-05-07 18:46   ` Susan G. Conger
2003-05-07 19:23     ` Andrew Choi
2003-05-07 19:31       ` Susan G. Conger
2003-05-07 21:02       ` Kevin Rodgers

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).