From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.tangents Subject: Re: Question: what is Emacs mode? Date: Sat, 24 Apr 2021 00:11:20 +0300 Message-ID: References: <5D47B4B9-87F5-40EA-A689-2618E3B8C6CE@mit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3020"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.0.6 (2021-03-06) Cc: "emacs-tangents@gnu.org" To: Qiantan Hong Original-X-From: emacs-tangents-bounces+get-emacs-tangents=m.gmane-mx.org@gnu.org Fri Apr 23 23:16:55 2021 Return-path: Envelope-to: get-emacs-tangents@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1la3AU-0000hI-WF for get-emacs-tangents@m.gmane-mx.org; Fri, 23 Apr 2021 23:16:55 +0200 Original-Received: from localhost ([::1]:60238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la3AU-00058Q-3D for get-emacs-tangents@m.gmane-mx.org; Fri, 23 Apr 2021 17:16:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la3A4-00053w-On for emacs-tangents@gnu.org; Fri, 23 Apr 2021 17:16:29 -0400 Original-Received: from stw1.rcdrun.com ([217.170.207.13]:46779) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la3A0-0004UE-Ja for emacs-tangents@gnu.org; Fri, 23 Apr 2021 17:16:28 -0400 Original-Received: from localhost ([::ffff:41.202.241.57]) (AUTH: PLAIN securesender, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 000000000002BECD.0000000060833923.000035A9; Fri, 23 Apr 2021 14:16:18 -0700 Content-Disposition: inline In-Reply-To: <5D47B4B9-87F5-40EA-A689-2618E3B8C6CE@mit.edu> Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-tangents@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Emacs news and miscellaneous discussions outside the scope of other Emacs mailing lists List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-tangents-bounces+get-emacs-tangents=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-tangents" Xref: news.gmane.io gmane.emacs.tangents:626 Archived-At: * Qiantan Hong [2021-04-23 23:53]: > I posted it on LtU forum http://lambda-the-ultimate.org/node/5630 > but I think other Emacs developers may have more insight into it. > > If you don’t want to follow the link, here’s the post: > > I've been using Emacs as my OS since time started and I've always > taken its programming model as granted, part of the nature. However, > now I'm looking back at it when I'm trying to design an editor/OS > based on S-exp rather than text, I found I understand Emacs very > poorly. Is it editor or OS? >From Emacs user viewpoint that abbreviation "editor/OS" actually makes sense as Emacs could be, almost could be the OS itself. > So here's the question: > What exactly are mode, buffer local variables, hooks and advices? > Hooks and advices look like AOP. However, emacs hooks and advices > usually make heavy use of buffer local variables. Lots of them also > interact with modes by looking at the mode variable. So I don't > think AOP captures the full picture. Was it question or statement? I am sure you know what those are. I am using buffer local variables for listings from database, so one buffer may show one listing, other different listing and each have same name of variable for program to work, and they are buffer local or otherwise it would be mess. > Sure, mode looks like context-oriented programming (see ContextL LtU > thread ). However I never see mode associated with dynamic scope, > they just got turned on or off (for a particular buffer). Is this > "resembling ContextL" impression just another instance of fitting a > too-general concept into a much more specific (but not understood) > concept? I know what is mode, and I am not sure if for mode we should say to be context oriented programming. >From Emacs manual: (info "(emacs) Modes") 23 Major and Minor Modes ************************ Emacs contains many “editing modes” that alter its basic behavior in useful ways. These are divided into “major modes” and “minor modes”. Major modes provide specialized facilities for working on a particular file type, such as a C source file (*note Programs::), or a particular type of non-file buffer, such as a shell buffer (*note Shell::). Major modes are mutually exclusive; each buffer has one and only one major mode at any time. Minor modes are optional features which you can turn on or off, not necessarily specific to a type of file or buffer. For example, Auto Fill mode is a minor mode in which breaks lines between words as you type (*note Auto Fill::). Minor modes are independent of one another, and of the selected major mode. But I know you know that all. > And finally, let me give the context that all those question arises: > I want to clean up the Emacs model, and apply it to a S-exp (tree) > based editor. So the practical question is: Can we find a > cleaner/more elegant version of the Emacs model, and generalize it > to tree document structure? Will we have node-local variables, > node-local modes, etc? If so, how will all those "attachments" > interact between, say, parents and children nodes? I do understand the intention. Not that it is clearly explained. Can you tell more about storing things in the tree? Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns Sign an open letter in support of Richard M. Stallman https://stallmansupport.org/ https://rms-support-letter.github.io/