From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: File modes facilities. Date: Fri, 21 Oct 2005 16:43:19 +0200 Message-ID: References: <87hdbdxo94.fsf@mahaena.lrde> <877jc92o37.fsf@mahaena.lrde> <17238.50816.352274.312799@kahikatea.snap.net.nz> <87u0fd9let.fsf@mahaena.lrde> <87oe5jmu9j.fsf-monnier+emacs@gnu.org> <87y84n81q2.fsf@mahaena.lrde> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1129910445 28177 80.91.229.2 (21 Oct 2005 16:00:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 21 Oct 2005 16:00:45 +0000 (UTC) Cc: Andreas Schwab , Michael Cadilhac , emacs-devel@gnu.org, Stefan Monnier , Eli Zaretskii , miles@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 21 18:00:40 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1ESzFb-0003Mm-Q6 for ged-emacs-devel@m.gmane.org; Fri, 21 Oct 2005 17:56:12 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ESzFb-0006Cp-0J for ged-emacs-devel@m.gmane.org; Fri, 21 Oct 2005 11:56:11 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ESy85-0002fP-L1 for emacs-devel@gnu.org; Fri, 21 Oct 2005 10:44:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ESy84-0002f3-T5 for emacs-devel@gnu.org; Fri, 21 Oct 2005 10:44:21 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ESy84-0002ey-EY for emacs-devel@gnu.org; Fri, 21 Oct 2005 10:44:20 -0400 Original-Received: from [195.41.46.237] (helo=pfepc.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ESy82-00077w-F5; Fri, 21 Oct 2005 10:44:18 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (unknown [80.165.4.124]) by pfepc.post.tele.dk (Postfix) with SMTP id 3434826282D; Fri, 21 Oct 2005 16:44:14 +0200 (CEST) Original-To: snogglethorpe@gmail.com In-Reply-To: (Miles Bader's message of "Fri, 21 Oct 2005 23:14:14 +0900") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:44507 Archived-At: Miles Bader writes: > Still, adding lisp interactive specs to C functions would be very > useful, and much cleaner than having 2*n functions, especially if it's > as simple as Kim suggested. Well almost..., I forgot about changing call-interactvely. Below is a complete patch (including the necessary patch to Fset_file_modes). Here is an example of how to set the interactive form. Of course, it should be changed to recognize octal and ascii forms, as the current base 10 form is useless for interactive use: (put 'set-file-modes 'interactive '(list (read-file-name "File: ") (read-number "Modes: "))) *** callint.c 14 Aug 2005 14:47:25 +0200 1.140 --- callint.c 21 Oct 2005 16:38:22 +0200 *************** *** 346,351 **** --- 346,356 ---- function = wrong_type_argument (Qcommandp, function); goto retry; } + else if (*string == '#') + { + string = 0; + goto get_interactive_form; + } } else if (COMPILEDP (fun)) { *************** *** 356,361 **** --- 361,367 ---- else { Lisp_Object form; + get_interactive_form: GCPRO2 (function, prefix_arg); form = Finteractive_form (function); UNGCPRO; *** data.c 19 Sep 2005 00:24:45 +0200 1.254 --- data.c 21 Oct 2005 13:04:24 +0200 *************** *** 787,793 **** if (SUBRP (fun)) { if (XSUBR (fun)->prompt) ! return list2 (Qinteractive, build_string (XSUBR (fun)->prompt)); } else if (COMPILEDP (fun)) { --- 787,801 ---- if (SUBRP (fun)) { if (XSUBR (fun)->prompt) ! { ! Lisp_Object spec; ! if (XSUBR (fun)->prompt[0] != '#') ! return list2 (Qinteractive, build_string (XSUBR (fun)->prompt)); ! ! if ((spec = Fget (intern (XSUBR (fun)->symbol_name), Qinteractive), ! !NILP (spec))) ! return list2 (Qinteractive, spec); ! } } else if (COMPILEDP (fun)) { *** fileio.c 20 Oct 2005 16:48:05 +0200 1.557 --- fileio.c 21 Oct 2005 16:21:25 +0200 *************** *** 3462,3468 **** return make_number (st.st_mode & 07777); } ! DEFUN ("set-file-modes", Fset_file_modes, Sset_file_modes, 2, 2, 0, doc: /* Set mode bits of file named FILENAME to MODE (an integer). Only the 12 low bits of MODE are used. */) (filename, mode) --- 3462,3468 ---- return make_number (st.st_mode & 07777); } ! DEFUN ("set-file-modes", Fset_file_modes, Sset_file_modes, 2, 2, "#", doc: /* Set mode bits of file named FILENAME to MODE (an integer). Only the 12 low bits of MODE are used. */) (filename, mode) -- Kim F. Storm http://www.cua.dk