From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Susan G. Conger" Newsgroups: gmane.emacs.help Subject: Re: Help me unlock a file while in emacs on the Mac Date: Wed, 07 May 2003 14:46:21 -0400 Organization: YOERIC Corporation Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1052333603 13880 80.91.224.249 (7 May 2003 18:53:23 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 7 May 2003 18:53:23 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Wed May 07 20:53:16 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19DU2W-0003b5-00 for ; Wed, 07 May 2003 20:53:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19DTzv-0006Nw-03 for gnu-help-gnu-emacs@m.gmane.org; Wed, 07 May 2003 14:50:35 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed.news.qwest.net!news.uswest.net.POSTED!congers Original-Newsgroups: gnu.emacs.help User-Agent: MT-NewsWatcher/3.2 (PPC Mac OS X) Original-Lines: 56 Original-NNTP-Posting-Host: 65.112.32.234 Original-X-Trace: news.uswest.net 1052333180 65.112.32.234 (Wed, 07 May 2003 13:46:20 CDT) Original-NNTP-Posting-Date: Wed, 07 May 2003 13:46:20 CDT Original-Xref: shelby.stanford.edu gnu.emacs.help:112905 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:9400 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:9400 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 , Andrew Choi wrote: > "Susan G. Conger" 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