From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Proposal: emacsclient --readonly Date: Tue, 26 Mar 2013 09:10:31 -0400 Message-ID: References: <87zjxtq304.fsf@michael-laptop.hsd1.ma.comcast.net> <1364142142.92134.YahooMailNeo@web160904.mail.bf1.yahoo.com> <1364266566.22342.YahooMailNeo@web160905.mail.bf1.yahoo.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1364303449 30767 80.91.229.3 (26 Mar 2013 13:10:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 Mar 2013 13:10:49 +0000 (UTC) Cc: "emacs-devel@gnu.org" To: Michael Mauger Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 26 14:11:16 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UKTeX-0007SY-4t for ged-emacs-devel@m.gmane.org; Tue, 26 Mar 2013 14:11:01 +0100 Original-Received: from localhost ([::1]:50520 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKTe9-0000hm-6b for ged-emacs-devel@m.gmane.org; Tue, 26 Mar 2013 09:10:37 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKTe6-0000hh-5U for emacs-devel@gnu.org; Tue, 26 Mar 2013 09:10:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKTe4-0005pp-NU for emacs-devel@gnu.org; Tue, 26 Mar 2013 09:10:34 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:49590) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKTe4-0005pj-J9 for emacs-devel@gnu.org; Tue, 26 Mar 2013 09:10:32 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFxLSu/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kLodwBrEfkA6RCgOkeoFegxOBTCQ X-IPAS-Result: Av4EABK/CFFFxLSu/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kLodwBrEfkA6RCgOkeoFegxOBTCQ X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="5801504" Original-Received: from 69-196-180-174.dsl.teksavvy.com (HELO pastel.home) ([69.196.180.174]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 26 Mar 2013 09:10:29 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 74EF7678A5; Tue, 26 Mar 2013 09:10:31 -0400 (EDT) In-Reply-To: <1364266566.22342.YahooMailNeo@web160905.mail.bf1.yahoo.com> (Michael Mauger's message of "Mon, 25 Mar 2013 19:56:06 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.182 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:158207 Archived-At: > So with this structure, how would I implement the --readonly custom > argument? Good question. > My guess is that the server-custom-option-function would scan the > incoming list of options for the -nowait entry because that will > determine our exit action. Hmm... why do we care about -nowait? > We will then look for the --readonly entry and record that we want to > view files rather than edit them. =A0We will then remove the --readonly > entry from the list to allow the remainder of the processing > to continue. Right, we check (equal "--readonly" (car args)) and if non-nil, we (pop args) and somehow register the "put in read-only mode" somewhere. > behavior. =A0Or we could essentially duplicate the server processing by > consuming all of the arguments and replicating their actions with the > wrinkles we wish to introduce which is obviously not a great solution. Right, we don't want to go there. > So it looks with the solution may be more flexible but requires global > variables specific to the feature and two hook functions to implement > it. My goal was for a solution the declares the options we want to add > and somewhat automate the parsing and validation of the option value > so that custom options behave as other command line arguments do. =A0It > then provides a handler function that implements the feature either > globally or on a per-buffer basis. =A0With this design, features could > be added to emacsclient by loading a library and adding an entry to a > list that defines the syntax and handling. Obviously, my proposal is incomplete indeed because it does not address the need to "register the `put in read-only mode' somewhere". But I think your design is too narrowly constrained by the needs you see now. I think we should aim for a design that could at least accommodate some of the features currently hard-coded such as --eval. Ideally it should also accommodate something like "--diff FILE1 FILE2" which would call `diff' on the two files and might even be made to accept "--diff FILE1 FILE2 FILE3" to do a 3-way merge. Stefan