4 ms·
Nice![1] What happens when you quit and restart? [1] No need to get personal, though :p
by akkartik 10y ago
Nice![1] What happens when you quit and restart?
[1] No need to get personal, though :p
- TeMPOraL 10y agoDidn't mean to sound personal - I was just involuntarily baiting the editor war discussion ;). > What happens when you quit and restart? I'd lose the changes because I applied them only to the runtime configuration. It'd be a few seconds more of work to save them permanently to my configuration though. In general, Emacs implements syntax highlighting by applying various "faces" to the highlighted parts. Those faces are highly customizable - including font foundry/family, various sizes, slant, as well as various decorations, foreground & background colors, etc. It has no problem rendering multiple fonts simultaneously (which is actually pretty useful if you're dealing with Unicode characters - your typical programmer's font won't have glyphs for many Unicode characters, so you can set "fallback fonts" for those). To de-bait the editor war trap, I think Eclipse can also pull that off, but I've left the only instance I have at work so I can't confirm it now :). --- EDIT: Crap, I think I misunderstood you. Did you mean "annotating" code with temporary style changes, especially in a semantic way? If so, I don't know of any editor that would support it out-of-the-box. In Emacs, you could probably hack your way around this with temporary font-locking (aka. adding an on-the-spot syntax highlighting for a particular symbol, and applying all the face-configuration-magic I described earlier), which I sometimes do when digging through log-files or grep results - there's a family of functions like "highlight-line-matching-regexp" or "highlight-symbol-at-point" with which you can quickly assign such highlights (and then there's a command that will write out all highlights in the format that you can save as a file-comment so that Emacs will reapply them the next time you open that file). But this is a hacky solution, IMO. This also brings me to my observation that there's literally zero tools out there for reading code. Something I'd love to change, and I keep gathering ideas, but I sadly lack time ATM to make even a proof-of-concept.
- akkartik 10y agoI have no doubt that you can apply various decorations to text, but that is also the part relatively less interesting to me. I'm more interested to see in what format you would save emacs's runtime configuration that would allow it to embiggen just one '&rest' in a file. Can you show an example of what this elisp would look like? Markup seems the most natural approach to me, to avoid issues with files getting renamed, etc.
- TeMPOraL 10y agoYeah, I've missed your point initially. I don't know how to do that exactly. In Emacs per se, you could probably abuse bookmarking facility - there are some built-in ways for Emacs to remember a particular place or region in a file that are somewhat resistant to changes in other parts of the file; AFAIR they involve a combination of storing the line number and the pattern describing the marked text / its surroundings. Or something like that. I've been playing with some Emacs libraries for annotating parts of file that would store those annotations in a separate place, but they were all rather crude. It's definitely an area that needs a lot of work. Markup seems to be the most robust approach, but sadly, it isn't supported by pretty much any tool in use.
- akkartik 10y agoAh, just saw your edit. I'm not sure what you mean by 'temporary', but there's two axes here: a) Is the formatting saved across restarts? b) Is the formatting customized for tiny parts of a file? What I'm looking for is 'temporary' for b) but 'permanent' for a). > This also brings me to my observation that there's literally zero tools out there for _reading_ code. Something I'd love to change, and I keep gathering ideas, but I sadly lack time ATM to make even a proof-of-concept. That is very close to my heart, though my theory is that reading code only becomes easier when the very representation of software projects undergoes a sea change: http://akkartik.name/about http://akkartik.name/about. I'd love to hear your thoughts!
- akkartik 10y agoAs an example of persistent-but-customized, check out this plugin of mine (in an inferior editor, sadly ;) which lets me highlight specific words in a random but persistent color: https://www.reddit.com/r/programming/comments/1w76um/coding_in_color/cezpios https://www.reddit.com/r/programming/comments/1w76um/coding_.... When I'm reading a strange codebase, finding a couple of key variables to colorize immediately causes the data flow of a function to "pop out" to my eyes.
- TeMPOraL 10y agoNice work on a plugin. I still have that experimental buffer opened, so I used the features for highlighting I described to highlight words "let", "buffer" and "create" with highlight-symbol-at-point, and the lines containing word "foo" with highlight-line-matching-regexp: http://i.imgur.com/ubXumzK.png http://i.imgur.com/ubXumzK.png The last four lines were generated by calling M-x hi-lock-write-interactive-patterns. If you save them in the file, Emacs can reload and reapply those highlights in the future. I use it mostly when browsing log files, though the feature is useful for code too. Since I'm addicted to traditional syntax highlighting, I prefer the background change when highlighting code.
- akkartik 10y agoYeah, I think what you showed is exactly what my plugin was going for. To get more fine-grained than that we'd need a smarter editor that understands markup. Fun conversation! I just shot you an email.