12 ms·
Emacs follow-mode
- cpr 15y agoI've been using Emacs for 32 years (hard to believe) and never knew about this incredible but apparently obscure feature of Emacs. On my 27" cinema display, even using 12pt Monaco for my tired old eyes for extreme legibility, I can get 4-5 columns of 90 lines each, when editing source files or text, for an effective "screen length" of 360-450 lines. With 10pt, you can get 500+ lines "on screen" easily. Docs: http://www.gnu.org/software/libtool/manual/emacs/Follow-Mode.html http://www.gnu.org/software/libtool/manual/emacs/Follow-Mode... .
- VirInvictus_ 15y agoI've been trying to get into Emacs for the last two years and can't seem to do it. How do you manage? Also, amen to Monaco (although I use 9pt).
- thom 15y agoIf you're using Monaco, I assume you're on a Mac, so you can get plenty of practice with the default key bindings, as OS X respects the basic emacs/readline bindings everywhere you can type. Discovering M-x apropos was probably the moment I realised emacs wasn't at all scary, and in fact just wanted to help and make me productive. A big hurdle with any text editor is having the discipline to realise that if you're doing something repetitive and boring, you're probably doing it wrong. All the built in documentation and help functions in emacs give you a big head start finding the right way to do what you're doing, and you'll just randomly pick up useful stuff along the way. Beyond that, it's just finding what modes are useful for you. Magit is incredible, org-mode's great if you do that sort of thing, and any language with a REPL thrives under emacs. Most people I know just learn enough elisp to keep their .emacs up to date, so don't be too intimidated by that, but more power to you if you eventually master it.
- chrismealy 15y agoI've only been using emacs for 18 years and I use 19pt Menlo!
- ekoontz 15y ago17 years here and I am happy to make my acquaintance with Follow Mode! :)
- swah 15y agoHow old are you current config files?
- cpr 15y agoOh, probably started them 10-15 years ago. Hard to say. I started around 1978 or so with Emacs on ITS (MIT-AI lab Incompatible Timesharing System), which was built in TECO. So those files wouldn't be very useful. ;-) Then moved to TOPS-20 Emacs in 1979-1980, then to Unix Emacs (Gosmacs) for a while in the early 80's, then, finally to the One True Emacs (Gnu Emacs) in the mid-80's on Sun workstations. I don't highly customize Emacs at all, actually. I tend to like a mostly vanilla installation that I can run in terminal mode both locally in Terminal (OS X) and remotely via ssh without even thinking about it.
- pasbesoin 15y agoOut of curiosity and seeing as you have considerable experience with Emacs, what do you do, keyboard-wise (e.g. remapping, custom hardware, or just the defaults?)?
- cpr 15y agoMostly defaults--I only have a handful of custom keybindings, most of them a carry-over from the old ITS/Twenex Emacs defaults, since I have editing finger habits which are decades old. (It's wonderful that you can get most of the basics in every Cocoa-based edit field in OS X.) I wouldn't even call myself an Emacs power user. I've written a modicum of Emacs Lisp, but nothing major. Custom hardware? Hoo boy, let's not go down that road, too off-topic. ;-) Well, OK, the best keyboard ever made by the Hand of Man is the old Tom Knight AI Lab keyboard (google "Tom Knight Keyboard" and you'll find lots of info). The particular recipe that Microswitch (Honeywell) developed for that generation of keyboards, based on (highly expensive) Hall-effect mechanical switches, is still unparalleled to this day--it had a sort of preternaturally comfortable throw. I even bought one of the Microswitch Symbolics-style keyboards from a custom run (for about $600) at LLNL back in the early 80's, and hacked up a Sun-1 CPU board to read the keyboard's up/down parallel encoding to produce ascii serial out, I was so attached to that quality of keyboard. (Didn't hurt that I could map all the Shift/Meta/Super/Hyper/Network shift keys to the appropriate escape sequences ;-). Had to give it up when ascii terminals died out; sigh. Since then, I've kinda given up, but the Thinkpad keyboards from a few years back were exceptional (don't know if Lenovo has kept the quality up lately), and the latest-generation Apple flat-topped short-throw keyboards are also exceedingly fast and accurate for typing. But none of them come close the pure tactile nirvana of those old Microswitch keyboards. You can still find some of those incredible Microswitch keys on older ATMs. They were designed for millions of abusive presses before failure. (Uh-oh, is my obsession showing? ;-)
- kraemate 15y agoI simply rotate my flatscreen monitor to make it upright. This way i get 900x1600 resolution, and >80 lines (10pt monospace) in one screen. 32 years of emacs! Wow!
- mitchty 15y agoI've not been alive for 32 years.... But still learning Emacs, I still run it in viper mode. My old habits die hard. I love to troll the other unix admins at work with vi keybindings in emacs. I'm assuming you aren't rotating your screen under linux, xinerama isn't very robust on things like that.
- kraemate 15y agoYep, using linux (and KDE). Screen rotation works perfectly. [stock intel 965]
- dmpatierno 15y agoIn vim, with scrollbind: nmap <silent> <Leader>ef :vsplit<bar>wincmd l<bar>exe "norm! Ljz<c-v><cr>"<cr>:set scb<cr>:wincmd h<cr>:set scb<cr> Source: http://markmail.org/message/kbnyhxffy6zs7pic http://markmail.org/message/kbnyhxffy6zs7pic
- pyre 15y agoThere is also this: http://mysite.verizon.net/astronaut/vim/index.html#MPAGE http://mysite.verizon.net/astronaut/vim/index.html#MPAGE
- beaumartinez 15y agoIt's a nice approximation, but it's also a hack—it doesn't take 'scrolloff' into account, and once you scroll too far in one of the windows they lose synchronisation. Edit: You can record a macro to do something similar—create a vertical split, switch to it, disable scroll-bind, go forwards one screen, enable scrollbind, then switch to the other window. This doesn't lose synchronisation but it doesn't take 'scrolloff' into account either.
- iamelgringo 15y agoYou can do that in Sublime Text as well: File -> Clone File http://www.sublimetext.com/ http://www.sublimetext.com/
- pyre 15y agoWill the cursor automatically swap between the buffers when you reach the edge? (e.g. buffer 1 is showing page 1 and buffer 2 is showing page 2; when you get the end of page 1, the cursor/focus switches to buffer 2, rather than it just being two independently scrolling views into the same file)
- cpr 15y agoThat's right--this is not just multiple views on one file/buffer, this is multiple views that are synchronized to follow one another, to give you the full effect of one long view.
- iamelgringo 15y agoNope.
- bretthoerner 15y agoWhat you've pointed out (Clone File) is part of the most basic functionality of Emacs. Splitting a window in 2 and opening the same file in both windows. It's the follow part that makes this, well, follow-mode. That said, I guess it's almost impressive that Sublime lets you "Clone", since TextMate is even more restricted in this regard, iirc. That's actually kind of sad, though.
- program 15y agoThe documentation is misleading. You can use follow-mode on an arbitrary number of windows that show the same buffer.
- nileshk 15y agofollow-mode is great. I use functions that: 1. split into three or four windows 2. balance the windows (so each takes up equal amount of space) 3. turn on line highlighting Line highlighting helps because when using follow-mode it can become difficult to quickly spot where the cursor is without it (e.g. if you do an incremental search, the cursor could end up in any one of the many windows). You can find the functions I wrote here, search for functions that end in "-and-follow": https://github.com/nileshk/emacs/blob/master/nileshk/functions.el https://github.com/nileshk/emacs/blob/master/nileshk/functio... What I'd like to have is a function that dynamically opens just enough windows so that the entire file you are editing is entirely visible (possibly with an upper limit for number of windows that can be set).
- 6ren 15y agoline highlighting is just what I need! For vim, it's :set cursorline Note: it's slow on old computers http://vim.1045645.n5.nabble.com/Vim-7-slows-down-when-highlighting-cursor-line-td1148280.html http://vim.1045645.n5.nabble.com/Vim-7-slows-down-when-highl...
- bch 15y agoI try to not be surprised by the power and flexibility of Emacs. Having been impressed so much over the years, I've tried to come to know it as simply "awesome". That said, it's hard to not be impressed when it shows itself as even more awesome, even when you thought you were prepared for that eventuality ;)
- zokier 15y agoemacs is one of those things I really would like to use, but never actually manage to bring myself to switch.
- eighty 15y agoI think a fun interview question might be how to implement follow-mode.
- to3m 15y agoWow, what role are you interviewing for?!
- deleted 15y ago[deleted]
- swah 15y agoOTOH if you need follow-mode, aren't your functions too long?
- pivo 15y agoProbably, but sometimes you have to work on other peoples's code. The worst for me was a 312 line function, which nearly caused me to quit.
- __rkaup__ 15y agoFrom the C code I've seen, 300 lines sounds like standard fare.
- LukeShu 15y agoI don't think that people give this situation enough credit. I once took over a project of about 30,000 lines of C++, with only about one line of commenting per 1,000 lines; and was frustrated with a lot of tools/documentation/suggestions that amounted to "don't write code like that". (Doxygen ended up being my friend)
- cpr 15y agoYes, but it's great to see your functions in context. I also use Emacs for text editing, and I'm writing a major manifesto right now which is thousands of lines.
- cageface 15y agoEmacs should have a dedicated manifesto mode.
- leif 15y agoSometimes you need to see context that extends past the boundary of a function.
- SoftwareMaven 15y agoI'd rather have too long than too short. I got some code recently where 3 lines was about the longest function (for a loop), and many functions were one line. It was nearly impossible to follow what was going on because you could never catch the "flow" of the code.
- aboodman 15y agoHey, really cool trick. Thanks for sharing!
- thebandrews 15y agoThanks for the post! The way I solved this problem in the past was to rotate one of my monitors 180 degrees. People always make comments when they walk into my cube for the first time, but you sure can fit a lot of txt on the screen. Maybe now I can go back to a normal orientation on my monitor.
- abcd_f 15y agoAlright, cool. So how is it called in vim? ;)
- gnufs 15y ago"A Guided Tour of Emacs" has a screenshot of the follow-mode along with a simple explanation: http://www.gnu.org/software/emacs/tour/ http://www.gnu.org/software/emacs/tour/
- by 15y agoThis would be good to build into the windowing system so it could apply to any application. Split any application window horizontally or vertically and put the two parts where you like on the screen.