Gettin The Sweet Sauce 64

Forum rules
Share your brain ;)
User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

Re: Gettin The Sweet Sauce

Unread post by DebianJoe » Thu Aug 08, 2013 5:42 pm

I'm sure that I won't have another day of throwing out quite so many things for a while, but every time I'd go to do something else...I'd think of something else to add. I'll try to taper it back to basics....and Bacon, I'm about tired of blue on black too. ;)

Artist Mode - Emacs Drawing
Image
(M^x artist-mode C^c C^a p <return>) to switch modes and set the first point. This one is another one that might be useful somewhere, but I would just have fun trying to draw funny little ASCII drawings. It's really simple. As long as you aren't at the end of a Buffer (so you may have to create some blank space with hard-returns in a new document), you use <return> to set point, and then move the cursor...lines will follow it. Hitting return again anchors that line at the cursor and starts a new line.

SES-Mode
Image
(M^x ses-mode) will start up ses mode, which is an archaic looking spreadsheet program. The main variation is that it uses lisp functions to do the math in the cells (+ B1 B2 B3) == sum B1:B3. SES-mode has some neat little aspects that can take some time to adjust to. "$%.2f" makes dollars and cents. C^o == insert row, M^o ==insert column.
|>>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 » Thu Aug 08, 2013 7:52 pm

Simple Lisp for QoL, and Using Shell Inside Emacs

I'm often entering the date/time into comments because I like to know in what order I've done certain things. So, I'm going to create a simple bind to make "C^c d" be my "Put the date/time into documents" option.
Image

Pretty cool...but once again, it's not really all that impressive. Hell, what would be really great is if I could execute a shell command, and pipe that info directly back into emacs....or even open up a shell INSIDE emacs, where I can use my "set-mark" "kill & yank" commands interactively with the unix shell? I think that would be great...and I'm a short (M^x shell) from bringing up a shell inside emacs, or (M^| <command> <RETURN>) from piping a single command through emacs using the shell.
Image

Also, if you just really want to, you can use (M^x term) to run a subshell in a terminal emulator, putting its typescript into an emacs buffer.
|>>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 » Thu Aug 08, 2013 7:59 pm

I've never actually done this but...

...Emacs could be your new conky.

This one looks like a lot of coding for something that I wouldn't actually use, but if someone here decided to use emacs as conky, then here's a link as to someone else who's done it before.
|>>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 » Thu Aug 08, 2013 8:48 pm

I dediacte this to DebianJoe who tried to save all those people.
http://linuxbbq.org/bbs/viewtopic.php?f=3&t=546
..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 » Thu Aug 08, 2013 9:40 pm

Very nice, Grillmeister.

I'm probably going to keep using Sauce for this tutorial, but the concepts from one should work for the other.
|>>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 09, 2013 5:18 am

C

I took all of the Solarized + Blue&Black I could, so I finally made a minor change so that my eyes might be able to see color again.
Image

Yet, I promised to leave the core of this thing untouched. So, that's exactly what I've done. Anyhow...
...let's set up some more programming with emacs. This time, I want to focus on what is really easy to set up, but any programmer worth their weight in salt will need at some point. C. Good old C. The best language for any GNU/Linux user to know, excluding "how to shell" because so much of the core of *nix is C.

"Curly braces lead to anger, anger leads to fear, and fear leads to suffering." - kensanata on #emacs

Emacs has a retarded default setting for C, where the curly braces are indented. Nobody does that except the people at gnu. You shouldn't do that either. It's stupid.

Code: Select all

if(shizzle)
    {
          I swear this is what it looks like if you don't fix it.
    }
If I ever see any of you guys doing this, or using C++ style brackets where you make a "statement{" like this....I will come totally unglued. Still, the above code is an example of gnu-styled C...and we need to fix that ASAP, because it is horrible.

Image

The code on the left-hand side of the screen is what you should append to your .emacs file, and then the stuff at the right is an example of how the indention will look when you're working on it. If you were going to submit code to the kernel, and it had the gnu-looking default, then Linus would scream at you for being an inbred hick, and then you'd get all butt hurt because "He's being mean and using curse words, and I'm a woman and blah blah blah..." and that's just a bad way to have it. Just do it right by making it look good the first time. :D
|>>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 » Wed Aug 14, 2013 9:52 am

Code Folding, the easy way

Well, since wordpress is bloat...and I've not got anything else going on right now, I thought I'd cover some more of the wonderful world of emacs. Today started off with me booting back into Sauce, and my 4-year-old sitting on the couch. He said "Dad, your screen is ugly." "It's TRUE, little bro!" So we worked on that by letting him pick out a wallpaper (which he chose a picture of a majestic elk...pretty cool) and I stole wuxmedia's colorscheme that he stole from Gutterslob. Now everything is right in the world.
Image

So, I got to looking at my .emacs file, and it's starting to get pretty hard to read...if only there was a clean way to get it to look better.

So, let's look at some code-folding. There's an included key combo that allows full code folding without us actually having to change anything. With a simple "M^1 C^x $", all of our functions will be reduced to one line by hiding all of the actual indented code. In order to unfold all of it, we can use C^x $. That's it. No fancy .el packages required. We don't even need to hack in any lisp...but, if we were going to be doing this very often, then a 6-keychain binding is really a lot of work. (For those of you counting and saying, "But that's only 5...not 6," think about how to make a "$". Yup, shift counts. Let's see if we can hack together a simple function to do this for us and tie it to a key we're not using.

Code: Select all

(defun joe-toggle-selective-display ()
       ;;fold code with F1 as a toggle
       (interactive)
       (set-selective-display (if selective-display nil 1)))
(global-set-key [f1] 'joe-toggle-selective-display)
Sweet, now I can use F1 to switch between code-folded, and normal views. I do LOTS of staring at code, so I'll get plenty of use out of this. If you don't code a lot, it may not be worth the trouble. Still, it's not a bad trick to keep if you're going to be hacking away at your .emacs file. It can get pretty unruly quickly, so even if you don't shortcut it, remember how to fold.

Image
Sweet, much easier to read
Last edited by DebianJoe on Wed Aug 14, 2013 11:18 am, edited 1 time in total.
|>>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 » Wed Aug 14, 2013 11:17 am

You TOO can be a winner!

I realize that a lot of the things I have become accustomed to over time may seem complex to a newer emacser. I tend to flip buffers and windows, even though I have a multiplexer. I think that a terminal multiplex like screen or tmux is one of the greatest inventions ever for more minimal systems, but I do also realize that some of the built in functionality of window switching with emacs may be confusing. While I of course suggest you RTFM, there is a great way to deal with the "Oh no, I just went to a new window...but I want to go back and I don't know how!" problems.

Introducing, "winner-mode"!!! Anywhere in emacs, use "M^x winner-mode" to check it out. What it does is bind C^c (right-arrow) or C^c (left-arrow) to the ability to go back or forward within the scope of your currently open emacs windows. (I'm not talking about frames, which you can see all at once, but in emacs...a window is kind of like "previous/next screen"...such as when you bring up --dired. Don't let this confuse you.)

Winner-mode takes most of the complicated key-chains out of navigating in different emacs windows. For newer users, this is far more approachable. It's almost EASY. Assuming that you check it out and like it, it's super simple to set as a constant variable in .emacs:

Code: Select all

(when (fboundp 'winner-mode)
      (winner-mode 1))
The fboundp will check to make sure it's available (ever since emacs20 and on non-Xemacs installs, it is....but let's be safe here) before it sets the value as true. This will allow any time that your .emacs file is sourced, such as on boot, for winner-mode to be set on by default.

...and who doesn't like being a winner.
|>>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 » Wed Aug 14, 2013 12:07 pm

Really simple tricks:

If you're coding something...anything. You can use "M^x delete-trailing-whitespace" to get rid of extra spaces at the end of a line.

If you've got a screwed up line, like where your toddler smashed on your keyboard while you went to get more coffee (ask me why I know this)...and say it looks like JLKJKNKJNLNLKNNKLKLKHLHLKHLKHJHKJH$USER, well, "M^z $" will delete every single character from the cursor to the first time that "$" shows up. This syntax will work for all characters, so "M^z k" would delete all chars up to "k"....etc. If you wanted to go to the second time that a "$" showed up, you could use "C^u 2 M^z e".

Better yet the "teach a man to fish" adage is a good thought here. Use "M^x isearch-mode-help" to learn how isearch can be HIGHLY manipulated to fit your particular searching/replacing/editing needs. Use "C^x 1" to kill the help "window" that pops up. ;)

If you'd like a list of ALL currently loaded major/minor modes, use "M^x *-mode <Tab>" to bring up a list of them.
|>>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 » Wed Aug 14, 2013 1:07 pm

you are truly a force of nature Joe.
thanks for uncovering my true nature, as a data thief. 8P
We spoke about this on IRC and I only wanted everyone to enjoy some Xcolours!
I hate slogging around a million threads on the arch board or #!'s effectively ineffective colour thread, thanks to Omps death.
I saw http://xcolors.net on the archboards and the guy has a great idea, when i realised i could actually make a -contribution- however small, i was happy (and more importantly *able*) to help.
I know you said it with a smile, i'm just jealous of your knowledge 8)
"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 » Wed Aug 14, 2013 2:24 pm

wux, I'm glad to have you guys sharing that which you can. I am horrible at making color schemes. The site you shared is a regular one for me on new installs.

Also, you guys feel free to ask "How can I ______" if you have questions about Sauce, Rice, emacs, etc. I may not have all of the answers, but I'll do my best to explain the dark potential that is often ignored.
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: Gettin The Sweet Sauce 64

Unread post by dkeg » Wed Aug 14, 2013 2:33 pm

EDIT: moved post to config thread. (was off-topic and pertaining to xres file)

cool stuff Joe, keep it coming!

Work hard; Complain less

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 17, 2013 9:32 am

Okay, enough with the colors. There's lots of threads about tweaking color-schemes, so I'll simplify everything by using a stock Sauce look to everything. I don't want to obscure the wonders of what we're doing with something like colors.

So, I got to thinking, "Wanderlust is pretty cool for email, but it's a larger external package. Why not be able to read my mail with gnus?" In case you're wondering, gnus is a newsreader, but with some minor tweaking...we can check e-mails with it. (note: this one took me a second to figure out.)

Image
^Look, now I can read email via emacs. :D

The secret to making this work is creating a simple emacs-lisp file that will handle the translation from nntp to nnml, and then start the authentication process. It MUST be named ~/.gnus.el, as that's what gnus automatically sources to get content aggregation from RSS feeds. I want it to read my linuxbbq e-mail, though, so check how I set that up on the right-hand side.

Code: Select all

;; This is the ~/.gnus.el file  ;;
;; Notes about what it does ;;
(setq user-mail-address "[email protected]")
(setq user-full-name "My Name")
(setq gnus-select-method '(nnml ""))
(setq mail-sources '((pop :server "mail.linuxbbq.org"
                                         :user "[email protected])))
Now, in practice, you can add <:password "muh_password123">, in the same format as the :server and :user lines if you wish to automatically authenticate. I've not yet gotten around to "reply" without using wanderlust, so give me a bit and we'll see how to reply to everyone in our mail list using the smtp server.
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: Gettin The Sweet Sauce 64

Unread post by rhowaldt » Sat Aug 17, 2013 10:47 am

haha that's really cool DJ, well done!
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

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 17, 2013 11:08 am

I must say I enjoyed reading this thread enormously, DebianJoe.

+1 for your effort to introduce emacs to the uninitiated.
While an emacs user myself, I already found some interesting items in here, and am looking forward
to more of this.

Keep up the good work. You are doing fine. I know a bit of reader feedback can work wonders as an incentive.

I plan on stepping in with some details about my own setup,.. when I am out of 'holiday mode', which largely depends on the weather we are having here.

(cond (good-weatherp (prefer 'biking 'browsing)))
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 17, 2013 11:41 am

@Dr. Xaos,
Thanks for the kind words. There will most certainly be lulls in this thread directly proportional to how many projects I'm trying to keep up at once, but I have every intention of continuing it until I have nothing left to add. Considering that the learning curve for emacs seems to be an endless spiral, I welcome any additions and variations.

Enjoy your holiday. ;)
|>>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 17, 2013 2:03 pm

super cool,
and nobody noticed just what kinda Spam Joe gets in his inbox 8)
i might even give this thread a run through, i'm feeling brave, and i have 4 computers next to each other. should be enough....
"Seek, and Ye shall find"
"Github | Chooons | Site"

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 » Sat Aug 17, 2013 2:25 pm

xaos52 wrote:I plan on stepping in with some details about my own setup,.. when I am out of 'holiday mode', which largely depends on the weather we are having here.
Now I'm curious :) Enjoy your holidays!
..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 7:57 am

You win some....

I'm 90% certain that I have gnus doing what I want it to do...but I'm not certain that what I have it doing is agreeing with the server. By any chance could someone verify that the linuxbbq mail server doesn't require port-specific authentication?

Image

I've obviously managed to route the mail to the server, but then it doesn't seem to be getting where I want it to go. I looked at how Bacon set up pop3/SMTP service in this thread, and it appears that I got it right.

Perhaps I'll set up a different client to make sure that it works as I had expected. You can't win them all. :)
|>>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 » Sun Aug 18, 2013 8:50 am

I need Tinyeat!!!

I used to have a little .el file called Tinyeat that would allow neat tricks like short-chained binds that would kill words in a line. So, whatever happened to that guy? I did a little searching and found that it was now a part of the package "Tiny Tools"...so let's go get that package:

First, I "M^x package-list-packages" and then C^M^s to search the listed packages for tiny-tools.

Image
Oh, no, it's not there!!!!...but I still want it. :D

So, let's find that fool. There's a git mirror at https://github.com/jaalto/project--emacs-tiny-tools for the main site at https://savannah.nongnu.org/projects/emacs-tiny-tools, and since we have git already, we should be able to set this up to track the package manually over time. (If I want the most up-to-date code, I can use "git pull" like you'd use "dist-upgrade" in Debian.)

First, I need a directory for my package, so I'll make a BIG directory to contain all of my packages so that I can do massive upgrades without forgetting what it was that I have pulled in. I'll call it "packages" and put it inside my .emacs.d directory. This way, I don't forget what all these little emacs.el files are for. I'm also going to add a note to upgrade it to my .emacs file, so I have little reminders sitting around.

Image

Top, left of screenshot: How to make the folder and pull in the package with git.
Bottom, left of screenshot: What to add to your .emacs file to make it require the options on opening emacs.


That's the basics of how to set up a bleeding-edge emacs package that uses development releases instead of the pre-packaged items in the repos. Now, I can "eat" words with 'Emacs-Tiny-eat' again. :D

note: This works well with simple packages that are all-inclusive. "Dependency Hell" exists for emacs too, which is why I pointed out the el-get option first. Use with care. Bleeding-edge is the same everywhere, things can break...use with care.
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

Post Reply