Gettin The Sweet Sauce 64

Forum rules
Share your brain ;)
machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Gettin The Sweet Sauce 64

Unread post by machinebacon » Sun Aug 18, 2013 4:56 pm

A bit off question: is there a notable difference (or preference) between emacs23 and emacs24? As in: is the newer package always the better option? I haven't looked into the changes between the two versions, to be honest, because I couldn't tell if any of the changes improves something for me (as I don't use emacs)
..gnutella..

User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

Re: Gettin The Sweet Sauce 64

Unread post by DebianJoe » Sun Aug 18, 2013 8:17 pm

I personally have found 24 to be a significant improvement. The "packages" system had to be manually integrated in 23, the built-in color-schemes started, and a few other 'quality of life' things were integrated.
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

Re: Gettin The Sweet Sauce 64

Unread post by DebianJoe » Fri Aug 23, 2013 7:45 pm

There's a few little things that I left out about why I personally believe that tmux is one of the greatest things to ever happen to emacs.

Tiling.

Okay, there, I said it. I have tried out the emacsd-tile package, and although it works with Xmonad key binds, you have to remap those. They disagree with one another. Still, I like dwm and Xmonad and DragonflyWM (wink wink*) and so I want to be able to use tiling even in a no-X system or stacking wm. Since I am using the stock twm in Sauce, I tend to blow up the windows to full-screen and then use the C^a M^1, or M^2, or whatever number from one to five to get different stacking layouts. If I want to rotate the position of the window on the screen, C^a { or C^a } will move it left or right.

Oh....I want BOTTOM stack,
Image

Code: Select all

C^a M^3
Image
BOOM!!!!

That's just too cool. Still, with emacs...you've got internal buffers and windows and frames to deal with. One of the things that totally blew my mind when I first got started was "How do I get from one buffer to the other?" Then I discovered "M^x buffer-menu" which is the equivalent for --dired, but allows you to select from the active buffers. Much like "winner-mode", it's not the fastest way to do it...but until you learn the fastest way, it will keep you from having to read man pages while you're trying to get something accomplished.

Even though all of this may seem very redundant, I can assure you...if you wanted to get around without X, there's always
Image
Sauce64 using fbdev0 instead of X to do the exact same thing that we've been doing.
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

User avatar
xaos52
The Good Doctor
Posts: 190
Joined: Thu Aug 15, 2013 11:59 am
Location: Eernegem, Belgium

Re: Gettin The Sweet Sauce 64

Unread post by xaos52 » Sat Aug 24, 2013 1:49 pm

In my eyes, if there is one key combination any emacs beginner needs to memorize, it is
C^h m
Which will popup a help window with a list of minor modes enabled, which is less important than a list of key bindings that are active in the current window.

The key bindings shown depend on the current mode, i.e. the list of key bindings associated with dired mode will differ from the list when you are in w3m mode, etc...

So, memorize the one keystroke that lets you discover all other possible key strokes.
Connected. Take this REPL, brother, and may it serve you well.

User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

Re: Gettin The Sweet Sauce 64

Unread post by DebianJoe » Sat Aug 24, 2013 2:19 pm

Very good tip doc. Especially for Major modes that oftentimes have very uncommon keychains (such as gnus, I still get lost in it sometimes).
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

Re: Gettin The Sweet Sauce 64

Unread post by DebianJoe » Sat Aug 24, 2013 4:15 pm

Buffers and some neat tricks.

Okay, so I went over one way to switch buffers, but it's not the method I'd actually use. I use 'iswitchb-buffer' because it's a lot shorter distance than the menu. If you want to take it for a spin, there's a few ways to do it. You can use live evaluation in the scratch buffer to just try it out (which we've covered before), or you can hack the line into your .emacs file for permanent use. It's easy.

Image

This is one of those days where I try something totally obvious that I've never done before. I used M^! to launch a shell, and then typed in 'scrot', which saves the trouble of having to leave emacs. Why didn't I think of this before? Probably because I'm stupid, because that's a really easy way to do it.

Anyhow, back to iseachb-buffer. The way it works is a lot like dmenu. With our appended lisp, C^x b will now bring up a list of buffers that are active, and while we're typing in the name of the one we want it removes the names of those that don't match. That's pretty cool. On the other hand, up and down pull up old buffers (for whatever reason) and left and right arrows....like what I'd use in dmenu, don't do anything other than tell me that I'm at the end of the minibuffer. That isn't cool, I want to be able to use my minibuffer to select which major buffer is available. Let's see.....LISP can make this happen. I'll append my little lisp snippet into my .emacs file so that I can get Joe's dbar minibuffer buffer selection action:
Image
Sweet!!! Now up and down don't do anything, and I can just scroll through the active buffers until I find one that I want. Also...scrot from emacs. ;)

So, we can forget all about the previous (and significantly more complicated to navigate) buffer switching.


!!! NOTE: iswitchb has been obsoleted since this post...see: THIS QUICK ANSWER! !!!

I also promised some fun little tricks, because that's what makes emacs fun while being the most insanely "riceable" text editor on the planet. Let's see....I have used it to pipe shell commands so that I can take screenshots from it, but what if I wanted to use shell to list all of the files in a directory....but move them INTO one of the buffers, perhaps for some kind of reason that I've yet to make up. I'm a programmer, so these things may need to happen. I can use "M^- M^!" which is a negatively prefixed call to the shell to pipe the results from the shell into the file that I have open. I can use "ls -a" into my *scratch* buffer to list all files (including hidden, you know... -a), and I'm going to do this in both windows.
Image
The RIGHT-hand image displays the results of "M^x occur <return> emacs" which performs a regexp through the entire file that I have open, and lists the lines that contain the words that I fed to the 'M^x occur'. I now know that if I had need to edit something about any lines that contained the word "emacs", that I have created a list to work through. I can then use either "M^x goto-line" or "M^g g" to bring up a prompt in the minibuffer that asks me to tell it what line to put the cursor on. So, I can jump through a huge document to the beginning of every line that contains my keyword.

May the lisp be with you.
Last edited by DebianJoe on Wed Oct 29, 2014 5:03 pm, edited 3 times in total.
Reason: typos...so many typos
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

User avatar
wuxmedia
Grasshopper
Posts: 6454
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: Gettin The Sweet Sauce 64

Unread post by wuxmedia » Sat Aug 24, 2013 5:09 pm

thanks for all these tips, I am trying to learn emacs. honestly.
the keybinds are a bit weird - but after the principal of tmux - it's not so bad.
so far its been a pleasure, opened a .php file from the command line, followed an include, with the php file still open, so i could check the name of the include... opened up (path was set to CWD, nice) *poof*, edit, save. hit F5 on other computers browser, update yay!
using noX version23
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

Re: Gettin The Sweet Sauce 64

Unread post by DebianJoe » Mon Aug 26, 2013 8:11 am

Browsing the Depth (term/shell mode).

Okay, so I went over launching quick shell commands from within emacs and piping the output from shell commands through emacs to a buffer, but what if I wanted to run a more complicated shell program? Well, there's always "M^x term" which turns the inside of the emacs buffer INTO the shell that you wish to run. You can even open ncurses-based applications inside of it, let's open ceni in emacs:
Image

Well, that's pretty cool. What about using grep inside emacs? Well, there's the option to open the shell, or...use lgrep or rgrep modes. Here's me using "M^x lgrep" and then answering the prompts in the minibuffer with 'setq' for criteria in file ~/.emacs and ~/ as a directory.
Image

lgrep searches in the current directory and rgrep searches the current directory tree. rgrep is compatible with version control systems (like git) so it can avoid searching control directories. One very interesting thing is that lgrep and rgrep share command argument history with grep. This mean that you after using them can use the grep command to for example filter the output results.
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Gettin The Sweet Sauce 64

Unread post by machinebacon » Mon Aug 26, 2013 9:11 am

The eshell hasn't been covered here yet (I believe), so I just leave a link here, hope it's OK - http://www.masteringemacs.org/articles/ ... ng-eshell/
..gnutella..

User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

Re: Gettin The Sweet Sauce 64

Unread post by DebianJoe » Mon Aug 26, 2013 9:22 am

Absolutely it's okay. Thanks for the link, and there's a lot of good stuff at that site (I started browsing it, and found it very interesting.)
Cheers!
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

User avatar
slartie
Grump
Posts: 416
Joined: Tue Jun 18, 2013 12:35 pm
Location: Denmark
Contact:

Re: Gettin The Sweet Sauce 64

Unread post by slartie » Thu Aug 29, 2013 6:31 pm

The overlord told me to go here and be useful.

So here I am.

User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

Re: Gettin The Sweet Sauce 64

Unread post by DebianJoe » Thu Aug 29, 2013 10:30 pm

Certainly. Feel free to add in your own tricks, setups, whatever.

Edit: By "overlord" do you mean Bacon....or Satan. I had performed the dark ritual of summoning slartie from the depths, so I need to know which it was so that I can jot down the success/failure rate of dark summoning rituals. ;)
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

User avatar
slartie
Grump
Posts: 416
Joined: Tue Jun 18, 2013 12:35 pm
Location: Denmark
Contact:

Re: Gettin The Sweet Sauce 64

Unread post by slartie » Fri Aug 30, 2013 2:54 am

In this case it was Mr. CookedPorkStrips, but you can share the success :)

User avatar
xaos52
The Good Doctor
Posts: 190
Joined: Thu Aug 15, 2013 11:59 am
Location: Eernegem, Belgium

Re: Gettin The Sweet Sauce 64

Unread post by xaos52 » Fri Aug 30, 2013 3:22 pm

Commenting lines of a file in emacs is fast

C^x C^f
enter file name in the minibuffer.
navigate to the first line you want commented - using arrow keys or C^n or C^p
C^space sets the mark
navigate to the last line of the block you want commented
the selected area is now highlighted - unless you switched that off
M^;
will comment the region.
C^x C^w to save

The comment character is deduced from the file type you read in,
If emacs can not deduce the comment char, it will ask for it in the minibuffer.

.conf file are recognized and lines in it can be commented out in a jiffy.
if it is a conf file but it does not have the .conf extension, sitch to conf-file mode: M^x conf-mode

To uncomment lines that are already commented out: same method. Emacs knows if a line is commented out or not.

idk if you can do that with nano :roll:
Connected. Take this REPL, brother, and may it serve you well.

User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

Re: Gettin The Sweet Sauce 64

Unread post by DebianJoe » Fri Aug 30, 2013 8:46 pm

In nano, it's easy to comment out multiple lines...you push the character you wish to use for the comment (#, //, ;;, etc) and then press the down arrow...and then type in the character again, then press the down arrow, and then........etc. :P

Please tell me that nobody has said something like "nano is just as full of features as emacs or vim"...because that would be foolish, and mistaken.
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

User avatar
slartie
Grump
Posts: 416
Joined: Tue Jun 18, 2013 12:35 pm
Location: Denmark
Contact:

Re: Gettin The Sweet Sauce 64

Unread post by slartie » Sun Sep 01, 2013 8:08 pm

Did anyone tell you that emacs is an amazing productivity tool? No? Well you're in for a treat.

Introducing: ORG MODE

You've been doing those To-Do lists with a sticky note program, or maybe even actual sticky notes (how 1990 of you), or perhaps you've had a couple of dedicated planner, todo, whatever programs sitting on your desktop - acting all cool like you're Tom Cruise in that movie 'n shit.

Well org mode is everything you've ever seen about planning, task management and a whole fucktonne more. Yep.

Got emacs, you got org-mode

M-x org-mode RET

You're good to go.

"Now what?!", you might say. Sitting around in an empty buffer with nothing but your johnson in your hand isn't really doing much, unless you made a really creepy interface you should message me about, immediately!

Well try this on for size. Type this:

Code: Select all

* Crap I need to do
** Hit on that girl at the Footlocker
** Tell my dad that the car was stolen
Notice how the asterisks get colored? that's because they're part of the org mode notation that automatically gets interpreted.

Move the point (cursor) to one of the tasks and hit C-c C-t (or S-<right arrow>).

Whaaaaaa?

Code: Select all

* Crap I need to do
** TODO Hit on that girl at the Footlocker
** Tell my dad that the car was stolen
Yeah, that happened. Do it again and it'll be marked as done.

Want to get a little fancier?

Put this [/] on the top line somewhere - like at the end. If you're a real emacs'er you'll press M-< C-e (like a boss) and do another update to one of your tasks.

Code: Select all

* Crap I need to do [0/2]
** TODO Hit on that girl at the Footlocker
** TODO Tell my dad that the car was stolen
"No way!" - Way!

And this is just the tip of the tip of the tip of the iceberg that is ORG MODE.

Of course you can nest stuff, collapse, expand and so on. You can make tables of data in a snap, schedule tasks, make agendas, expand the TODO states (perhaps you'd like "Procrastinate" and "Whenever I get to it" as a todo status, well you can), Your entire document can be exported as HTML. With a few header hints as to what *, ** and other key tags should mean, you can create a complete website inside org mode.... and MORE.

http://orgmode.org/ - shit just got real.

User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

Re: Gettin The Sweet Sauce 64

Unread post by DebianJoe » Tue Sep 03, 2013 8:47 am

I'm going to start this one off with a quote!
Sauce + nullWM = Awwww yheaaaa! -slartie
So, I did it. Then I remembered that there were a few things about Sauce that might not totally agree with nullwm. Primarily, Sauce uses urxvt as the terminal emulator (which is good, because it's a great xterm replacement), and instead of emacs24 in fullscreen...it has emacs23 as the X-emacs version. 1/2 of the reason to use emacs in X is due to clickable menus and such.

But let's see why Slartie "might" have made the connection between sauce and null.

Sauce = Terminal+Tmux && Emacs is what is does best.
null = Terminal && Emacs is ALL it does OOTB.

So, since there's such a distinct connection, I rebuilt nullwm with an option to "make sauce" instead of the standard "make". This way, if someone is a Sauce64 user...then they don't have to deal with getting xterm or something stupid like that, as it's easier for me to give more options with the wm than have an end-user get and configure a different (and not as awesome) terminal emulator. Still, urxvt doesn't have a maximize or a full-screen option without downloading a perl addon for it, so I just hard-coded the geometry. If you need it to fill your every little desire, then hack the C before building. It's easy. If you don't understand how, then e-mail me and I'll walk you through how to make it work for you.

Anyhow, HOW-TO nullWM on Sauce64:

Code: Select all

sudo apt-get install libX11-dev
git clone https://github.com/DebianJoe/nullWM
cd ~/nullWM
make sauce
sudo make install
Then, hack up your .xinitrc and replace "exec twm" with "exec nullwm" and then fire that son-of-gun up.

A few minor changes to the sauce version is that it launches urxvt with tmux using F11, and Emacs23 GUI-Graphical monstrosity mode with F10. NOT BOTH AT THE SAME TIME, muh ha ha ha. Learn to use emacs for shell!

Image

Now, you can freely purge all of the bloated xbindkeys and irssi and whatever else. Screw those programs! We're emacs up in here!!!
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

User avatar
slartie
Grump
Posts: 416
Joined: Tue Jun 18, 2013 12:35 pm
Location: Denmark
Contact:

Re: Gettin The Sweet Sauce 64

Unread post by slartie » Tue Sep 03, 2013 9:01 am

Yeah, I already did that hack to make it work for sauce :) ... and I have to have urxvt. It's just an amazing term.

I replaced emacs23 with *24 because it just makes sense, and got rid of everything else.

I dislike erc, so I've been toying with the idea of making a "proper"(tm) IRC client for emacs, but I have yet to take the plunge and get down'n'dirty with elisp. I'm lazy in that way. I like writing more than coding these days.

User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

Re: Gettin The Sweet Sauce 64

Unread post by DebianJoe » Tue Sep 03, 2013 9:17 am

I actually like erc. On the other hand, if you ever get around to doing it, I'll gladly test it for you.

I need to start writing more emacs-lisp myself. I strongly considered using common lisp for the WM, but the dependencies for most people would be a nightmare.
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5878
Joined: Tue Sep 03, 2013 7:05 am

Re: Gettin The Sweet Sauce 64

Unread post by GekkoP » Tue Sep 03, 2013 5:58 pm

Amazing stuff in here. Lots, lots to learn. Thanks for sharing, I'm falling in love with emacs.

Post Reply