* Question: what is Emacs mode? @ 2021-04-23 20:43 Qiantan Hong 2021-04-23 21:11 ` Jean Louis 0 siblings, 1 reply; 8+ messages in thread From: Qiantan Hong @ 2021-04-23 20:43 UTC (permalink / raw) To: emacs-tangents@gnu.org 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. 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. 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? 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? ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Question: what is Emacs mode? 2021-04-23 20:43 Question: what is Emacs mode? Qiantan Hong @ 2021-04-23 21:11 ` Jean Louis 2021-04-23 22:04 ` Qiantan Hong 0 siblings, 1 reply; 8+ messages in thread From: Jean Louis @ 2021-04-23 21:11 UTC (permalink / raw) To: Qiantan Hong; +Cc: emacs-tangents@gnu.org * Qiantan Hong <qhong@mit.edu> [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 <SPC> 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/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Question: what is Emacs mode? 2021-04-23 21:11 ` Jean Louis @ 2021-04-23 22:04 ` Qiantan Hong 2021-04-24 4:22 ` Jean Louis 0 siblings, 1 reply; 8+ messages in thread From: Qiantan Hong @ 2021-04-23 22:04 UTC (permalink / raw) To: Jean Louis; +Cc: emacs-tangents@gnu.org > 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. Yes, and my understanding is that as long as some software commit to a statement of the form “everything is X” (I call it ontology), it will become an OS (because people will do everything with X). - UNIX commit to “everything is file, aka big bagged of unstructured bits” - Emacs (maybe unintentionally) makes everything text (with some attached text-properties). Alas now people are using text (w/ properties) to make outlines, tables, images… - Browsers makes every data XML and every code JavaScript (line between code and data is a little blurred, but definitely not like Lisp). You get what you get. - Smalltalk commit to “everything is object”. And you get OS also. This understanding is exactly what motivate me to start designing my own editor/OS/computing environment. Now when you spell out the “X” in “everything is X”, IMO it become apparent that the above examples don’t make particularly good choices. Everyone knows UNIX sucks (unstructured bits err), browser sucks (no homoiconicity). Smalltalk lack a good editing protocol for standard objects (you can’t forward-sexp backward-sexp to roam in the object graph), while Emacs isn’t that structured. In fact, Emacs is just a little bit better than UNIX in terms of ontology. That makes me wonder if we can make a better environment by committing to “everything *visual* is s-expr” (I don’t want to make everything in the system s-expr, because sometimes hash tables and vectors are fast. There’s a present/recognize system to map them to visual s-expr when user want to see them). And then one can use the standard structured s-expr editing commands to edit the whole live system. The model is kind of like CLIM, except that it’s much more, because CLIM doesn’t touch editing of presentations (the original AITR 794 did). >> 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? As I said above, I’m going to use s-expr as the primary data structure, a document is just an s-expr. That opens up some new possibilities but also associated problems: (I just realized I think I answered most of them myself, but I’m not confident with my answers) 1. Do we want node-local modes? That looks very natural to have. We may edit our code using sexp-mode, but inside docstring, we could use doc-mode locally. This also covers lots of thing in Emacs that were done using text-properties. E.g. bold-mode and background-color-mode (not sure if they’re good idea though). 2. If we have node-local modes, what about node-local variables? Virtually all modes use buffer local variables. If we have node-local modes, do they all share the buffer-local environment? That sounds like a mess. This is one point where I can’t decide between introducing node-local variables, or try to figure out a “cleaner” version of modes that don’t need *-local variables. 3. Suppose we now have node-local variables and node-local modes, what’s the relation between those of parent nodes and child nodes? It seems natural to let child node inherit modes and variables from parent nodes. E.g., I might just turn on outline-mode on the ‘((Section title-A …)) node in (defun very-complex-function-that-require-a-paper () ‘((Section title-A (Paragraph lorem ipsum) (Section subtitle-B (Paragraph lorem ipsum)))) *code*) And it affects the whole sub-tree. However, are there cases that one don’t want a whole subtree to inherit a mode/variable? Can we safely assume they all get inherited? If we assume yes, then we arrives at node-local first-class environment. Each node may have an environment, chained to the environment of its parent. It turns out that we don’t seem to need seperate window management as well, each frame can just display a *frame-root-sexp* in window-mode, and some of it child turns on buffer-mode, which essentially becomes buffers. This raises another questions though. Apparently window-mode and buffer-mode need to be exclusive. In emacs, there is one and only one exclusive set of modes, managed by the major-mode variable. Are we sure there only need to be one exclusive set? ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Question: what is Emacs mode? 2021-04-23 22:04 ` Qiantan Hong @ 2021-04-24 4:22 ` Jean Louis 2021-04-24 5:00 ` Qiantan Hong 0 siblings, 1 reply; 8+ messages in thread From: Jean Louis @ 2021-04-24 4:22 UTC (permalink / raw) To: Qiantan Hong; +Cc: emacs-tangents@gnu.org * Qiantan Hong <qhong@mit.edu> [2021-04-24 01:05]: > 1. Do we want node-local modes? > That looks very natural to have. We may edit our code using sexp-mode, > but inside docstring, we could use doc-mode locally. > This also covers lots of thing in Emacs that were done using text-properties. > E.g. bold-mode and background-color-mode (not sure if they’re > good idea though). TECHNOLOGY TEMPLATE PROJECT OHS Framework https://www.dougengelbart.org/content/view/110/460/ I suggest that you also look at Doug Engelbart's work. Your plan seem that text will become s-exp, chunked, and this may allow very fine elementary objects to be incorporated, further you can read in that reference what else could be done. That type of s-exp text could become so much more than Hyperlinked text. > 3. Suppose we now have node-local variables and node-local modes, what’s the relation > between those of parent nodes and child nodes? > It seems natural to let child node inherit modes and variables from parent nodes. > E.g., I might just turn on outline-mode on the ‘((Section title-A …)) node in > (defun very-complex-function-that-require-a-paper () > ‘((Section title-A > (Paragraph lorem ipsum) > (Section subtitle-B > (Paragraph lorem ipsum)))) > *code*) > And it affects the whole sub-tree. > However, are there cases that one don’t want a whole subtree to inherit a mode/variable? > Can we safely assume they all get inherited? I will say something what may not look possible, I rather think it is possible. It would be good if each of those nodes would have its unique ID, as then it becomes possible to have someting similar as OPML able to reference those parts of text even if the node change its position. Maybe is not feasible. When thinking about modes, they are turned on automatically in Emacs based on some factors of recognition like extension or magic headers or else. Your each different node could have a different mode, why not, that is liberty then. Question is the speed. Will that system have extension language and which one? Will it be Emacs Lisp or different? -- 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/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Question: what is Emacs mode? 2021-04-24 4:22 ` Jean Louis @ 2021-04-24 5:00 ` Qiantan Hong 2021-04-24 9:22 ` Jean Louis 0 siblings, 1 reply; 8+ messages in thread From: Qiantan Hong @ 2021-04-24 5:00 UTC (permalink / raw) To: Jean Louis; +Cc: emacs-tangents@gnu.org > TECHNOLOGY TEMPLATE PROJECT OHS Framework > https://www.dougengelbart.org/content/view/110/460/ > > I suggest that you also look at Doug Engelbart's work. Nice! Seems that lots of ideas in it can be incorporated naturally into my model. > I will say something what may not look possible, I rather think it is > possible. It would be good if each of those nodes would have its > unique ID, as then it becomes possible to have someting similar as > OPML able to reference those parts of text even if the node change its > position. Maybe is not feasible. In a live system, every object automatically get a unique identity, which is their intrinsic object identity (on many implementations it’s the pointer address). It’s already used for cursors and markers in my current experimental system and I wrote editing command carefully to preserve identity as much as possible (so the cursor and markers can moves “along” with edited code). So to some sense, I already have it. Now I read the OHS framework, it makes some sense to me that sometimes we want human interpretable ID. Currently I’m imagine giving some tags to some node, and hope the tags from the root to a given node uniquely determine a node. It doesn’t have the property that you can always determine a unique node though… > Question is the speed. > > Will that system have extension language and which one? Will it be > Emacs Lisp or different? Sure, my current experiment is written in Common Lisp, and Common Lisp automatically become its extension language. It’s an “extended” Common Lisp though (aka with some macros), because I need to support buffer/node-local environment and advices. For a serious long-term projects, I’m not sure if CL is the right way to go. It’s too adhoc and unnecessarily complex to my taste, and it also lack some important features (the-environment and call/cc). My ideal language, to this day, seems to be GNU/MIT Scheme. (I don’t like Guile better than CL. It doesn’t have full first-class environment support and strictly speaking not even full call/cc, because it has to corporate with C runtime). ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Question: what is Emacs mode? 2021-04-24 5:00 ` Qiantan Hong @ 2021-04-24 9:22 ` Jean Louis 2021-04-29 3:39 ` Qiantan Hong 0 siblings, 1 reply; 8+ messages in thread From: Jean Louis @ 2021-04-24 9:22 UTC (permalink / raw) To: Qiantan Hong; +Cc: emacs-tangents@gnu.org * Qiantan Hong <qhong@mit.edu> [2021-04-24 08:00]: > > TECHNOLOGY TEMPLATE PROJECT OHS Framework > > https://www.dougengelbart.org/content/view/110/460/ > > > > I suggest that you also look at Doug Engelbart's work. > Nice! Seems that lots of ideas in it can be incorporated naturally > into my model. When building also see: Hypothes.is Annotate the web, with anyone, anywhere. https://web.hypothes.is/ I am referring to the concept of referencing, not to specific annotation of PDF files. What you are presenting is s-exp based structure of text, but it could be structure of any kinds of objects. In that structure, some object could have its annotation or labels. Let us say that paragraph A speaks about fruits, but paragraph B about vegetables. Those would be labels, and there could be unique ID that identifies each paragraph among all of other paragraphs. Then comes interesting feature, which I use myself as I use database with unique IDs for each objects. Then it becomes possible to reuse the paragraph in other documents. It is possible to refer to paragraph from any document. It allows multitudes of hyperlinking. One can then hyperlink to visually normal text documents to specific paragraphs or specific sentences if necessary. It requires deep thinking or practical experience to understand this concept. It is hyperlinking and referencing on a lower level then just documents. Compared to HTML, we have hyperlinking to documents and hyperlinking to parts of a document if they have their anchors, such as: https://www.example.com/some-document.html or hyperlinking to part of a document such as: https://www.example.com/some-document.html#heading-2 If all information would be in a centralized database with s-exp or other trees, and each new paragraph unless deleted, has its unique ID, then it becomes possible to hyperlink to each unique sentence even a word in a different document. Similar activity I do here by typing document, for example in markdown, Org, asciidoc mode but when I need to hyperlink I am not going to re-type the words by my hand, mostly I will search in the dynamic knowledge repository by query like let us say "hypothes.is" and in other buffer I can see few of results, I select right one, and hyperlink is constructed and transferred to other buffer. In this case if buffer is text, it looks as this: Hypothes.is Annotate the web, with anyone, anywhere. https://web.hypothes.is/ But if buffer would be markdown, it would look as [Hypothes.is Annotate the web, with anyone, anywhere.](https://web.hypothes.is/) and if it would be asciidoc, it would look as: https://web.hypothes.is/[Hypothes.is Annotate the web, with anyone, anywhere.] But if it would be s-sexp, then cursor position would be located, this would give s-exp element and the element would get a hyperlink, but not to the text or URL necessary, rather to the other s-exp element. Hyperlink would be unique among all documents on a computer. It could be something user does not see, like a hash or simply unique ID. If one uses integers, it would need to take care of any limitations. Such s-exp documents would be, I am just giving idea, centrally recorded in the collaborative and network accessible database, but they could be also saved. When saved, s-exp document would have pointers to the host/database/port as to allow unlimited hyperlinking and referencing. Text document becomes hypertext. User however does not think of any markup because it is all in underlying s-exp and database structures. Hyperlinking to anything becomes possible, one could quickly browse from one document to other, obtain references, write research works easier, publish all related references, find out which other documents are referencing to specific sentence, word, even letter or symbol. That implies that user should have option to say that some elements are independent. As soon as element has been assigned independent identity it is one node in s-exp that can receive its general markup, or hyperlink, or other attributes. It is only by concept similar to HTML, but I speak of much more ingrained hyperlinking and information management. User can however, add any markup user wish and wants, or dynamically modified markup. Dynamic markup would be something like to tell that text is bold, it appears bold, but markup is invisible on screen. Instead of **bold** in markdown it would appear just as word "bold" but it would be bold, however, presented as simple text. If editor is good, it can be presented nicer similarly as word processor. S-exp structure can then be used to convert such documents into anything else with finely grained references or anchors. You can see how this document is finely referenced by anchors on right side: About Dynamic Knowledge Repositories (DKR) https://www.dougengelbart.org/content/view/190/163/ But now imagine that even sentence may be referenced. Documents could be then presented on a tablet or special devices, not just monitors, and one could see slight highlighting of some elements, if sentence is referenced in other document, I could click on link and read only the sentence, and decide if I wish to read all of the other document, then come back. Document becomes that way more than what Org-mode is, it becomes meta-Org, meta-anything, it is on meta-level of anything. Problem is that it binds documents to be edited with the specific editor that allows such features. Those are ideas, of course many are not related to your intentions. IMHO s-exp and unique IDs should work together, all documents on one file system SHOULD be unified into one whole. File system was meant to unified documents, in beginning those were mostly files. As technology developed, we got pictures, sound, video, PDF files, thousands of various formats. Those formats are not unified into one computing environment, we waste time as humans, this all comes because companies sell proprietary software and there was never attempt neither demonstration how everything could be integrated into one as nobody attempted it before. We think and take file system for granted, but it is obvious that it is flawed design. For example, user is on computer has 10000 files and there is no unified way of locating or searching for exact files. We got used to this condition that we think it is normal, but it is not, we have computer that is capable of helping human to locate anything, but there is no unified system for it, and none computer has that as a built-in feature. If all documents in one computer can be addressed uniquely and they could be handled by databases, then such system becomes unified. Each sentence could be designated as unique object and such object could be referenced from any other computer in the world, if it is public or user has permissions. For example a user in Boston could reference in his research to the document located in Springfield, by using URI-similar notation, like user/password with hostname/database/object ID. Reality is that files are related to other objects, normally files are related to people, people are related to locations, their contacts, other people, groups, companies, organizations, we have obligations towards people, reminders, transactions, files belong to project software, are similar to other software and so on. Majority of this knowledge is not unified in our computing environments. Would elementary objects be rich described, with unique IDs, as stored in the dynamic knowledge repository as described by Engelbart, we would be creating much more than what Internet is today. Internet is rather defective by its whole concept as it does not unify computing of people, it is more like information management. User is unable to easily reference and find references, one has to be proficient. > > I will say something what may not look possible, I rather think it is > > possible. It would be good if each of those nodes would have its > > unique ID, as then it becomes possible to have someting similar as > > OPML able to reference those parts of text even if the node change its > > position. Maybe is not feasible. > In a live system, every object automatically get a unique identity, > which is their intrinsic object identity (on many implementations > it’s the pointer address). Would it be unique to single document? I am thinking how better would be that one computing environment becomes "document" rather dynamic knowledge repository and all other objects just part of one big whole. That way inter-referencing becomes possible. If is is really unique among all information in one computer, even better if unique among all other computers, then it gets its power. Those hand moved hologram computing that we can see on movies becomes possible, as then all objects are related to each other and research becomes very fast. A word/sentence/paragraph/document/picture/video/you name it, may be related to person, person's picture, videos, movies, other text, sentences, etc. We don't have that capability in today's file systems. We have not get easy integration for example to relate a video to group of people. This is such a basic paradigma that people who use computers cannot easily grasp it. People who use paper photographs may start sorting photographs by physical albums for example for each child separate album. But on some pictures there are multiple pictures. Either duplicates will be placed or some pictures will be missing in other albums. By researching album of one child, one can see that child was related to other one, one can pick other album and find more related people and understand all relations. What we do in life all time is we want to figure out all relations. In computing environment it is possible to build relational systems, it helps human in learning, locating, understanding of the subject. Things are hard to understand because they are not related. File system does offer basic tree based relational system, but within the tree or across the trees one could not possibly know what is related to what. IMHO any document creation on single or multi user computer, would not be document in itself, it would be a node of the whole, just that other users would not be able to access it without permission. It sounds like file system, the difference would be that there is rich set of relationship attributes. Document would be first need to be updated to what it is related, maybe document is related to specific note for specific person, user, customer, maybe it is related to specific sentence and gives annotations on that sentence, maybe to video on local computer, remove computer, or specific frame or period from 04:01 to 04:03 in a specific video located remotely, and when all relations have been defined and they would be updated from time to time semi-automatically, it created super-knowledge, relationship and association based system that aids human memory and mind. IMHO, media files and any kind of files would be just nodes in one overall s-exp or other tree or ordered database system. Relations and associations would be possible from any elementary object to other object. Elementary Objects Objects are basic content packets of an arbitrary, user and developer extensible nature. Types of elementary objects could contain: - text - graphics - equations - tables - spreadsheets - canned-images - video - sound - code elements, etc. Mixed-Object Documents Documents are a coherent entity made up of an arbitrary mix of elementary objects bundled within a common "envelope" to be stored, transmitted, read, printed, or otherwise be operated on. The MIME specification is an example of a document definition based on a higher level collection of elementary objects ==== Imagine a text where specific term like "salary calculations" embeds whole spreadsheet inside. When such text is sent to somebody as a mixed-object document, other person can access it and research it. But instead as in MIME to save the file, use other software, etc. it would be all unified in one. It is of course hard task to go, as we are now in specific computing environments as dictated by plethora of circumstances, but definitely not the best computing environment that could exist as of 2021. We are way behind technologically on this planet. > Now I read the OHS framework, it makes some sense to me that > sometimes we want human interpretable ID. Currently I’m imagine > giving some tags to some node, and hope the tags from the root to a > given node uniquely determine a node. It doesn’t have the property > that you can always determine a unique node though… The ID need not be seen at all if system unifies it all good and well. It should be human readable ID, but need not be complex. You can see example with 2a31 notation on OHS hyperlinks. But that does not make the elementary object very unique. Better notation would be something like: host/database/elementary-object -- but my talking here is too abstract and hard to understand, I am aware of it. > > Will that system have extension language and which one? Will it be > > Emacs Lisp or different? > Sure, my current experiment is written in Common Lisp, and Common > Lisp automatically become its extension language. It’s an > “extended” Common Lisp though (aka with some macros), because I need > to support buffer/node-local environment and advices. Send me that experiment that I can try it out. > For a serious long-term projects, I’m not sure if CL is the right > way to go. It’s too adhoc and unnecessarily complex to my taste, and > it also lack some important features (the-environment and call/cc). > My ideal language, to this day, seems to be GNU/MIT Scheme. (I > don’t like Guile better than CL. It doesn’t have full first-class > environment support and strictly speaking not even full call/cc, > because it has to corporate with C runtime). No idea of technicalities. I have just practical problems, Guile is difficult to run and build on many systems, there are various incompatibilities. CL I have seen running practically better and easier. I also like the concept of compilation or binary product that has all of the LISP inside that one needs. MIT Scheme, I have tried, I like that it has PostgreSQL bindings, there is also edwin built-in editor. IMHO the system you presented sounds like you would make your own LISP. That would be best, but we don't have it. We have slow Emacs running as top layer of layers of layers of layers of underlying number of layers. -- 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/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Question: what is Emacs mode? 2021-04-24 9:22 ` Jean Louis @ 2021-04-29 3:39 ` Qiantan Hong 2021-04-29 5:02 ` Jean Louis 0 siblings, 1 reply; 8+ messages in thread From: Qiantan Hong @ 2021-04-29 3:39 UTC (permalink / raw) To: Jean Louis; +Cc: emacs-tangents@gnu.org Thanks for Jean’s input! Now I’m stuck on one particular design choice > 3. Suppose we now have node-local variables and node-local modes, what’s the relation > between those of parent nodes and child nodes? > It seems natural to let child node inherit modes and variables from parent nodes. > E.g., I might just turn on outline-mode on the ‘((Section title-A …)) node in > (defun very-complex-function-that-require-a-paper () > ‘((Section title-A > (Paragraph lorem ipsum) > (Section subtitle-B > (Paragraph lorem ipsum)))) > *code*) > And it affects the whole sub-tree. > However, are there cases that one don’t want a whole subtree to inherit a mode/variable? > Can we safely assume they all get inherited? I’m hitting an implementation problem when trying to implement the “inherit” model. Because modes are stored as node-local variables (or, node-local environment), it makes functions that have mode-specific advices/hooks installed searching up through the document tree multiple time on every invocation. One alternative is don’t implement “inherited” variables, but instead copy the surrounding bindings when making new nodes, to fake “inherit”. This will cost lots of space however. I have one way to improve the hopeless naive implementation of “inherited” model in mind. The naive environment implementation is a deep-binding implementation. One can switch to shallow-binding, maintaining the effective environment at selected node, making variable accesses O(1). However, this is complicated by the fact that the structure of our document tree is frequently changing, and getting it correct might be very difficult. Any thoughts? ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Question: what is Emacs mode? 2021-04-29 3:39 ` Qiantan Hong @ 2021-04-29 5:02 ` Jean Louis 0 siblings, 0 replies; 8+ messages in thread From: Jean Louis @ 2021-04-29 5:02 UTC (permalink / raw) To: Qiantan Hong; +Cc: emacs-tangents@gnu.org I think Emacs text properties already are sexp which may contain any Lisp structure. Why would you make node local? What is the use? Jean ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-04-29 5:02 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-04-23 20:43 Question: what is Emacs mode? Qiantan Hong 2021-04-23 21:11 ` Jean Louis 2021-04-23 22:04 ` Qiantan Hong 2021-04-24 4:22 ` Jean Louis 2021-04-24 5:00 ` Qiantan Hong 2021-04-24 9:22 ` Jean Louis 2021-04-29 3:39 ` Qiantan Hong 2021-04-29 5:02 ` Jean Louis
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).