Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Hollow Talk
Feb 2, 2014

ynohtna posted:

On top of what Hollow Talk correctly states, upcase-region is also mapped by default to a key sequence that a new user may invoke accidentally before they have learnt the core of how Emacs works and - vitally - how to invoke the essential undo operation.

Quite right. I still sometimes hit some of these functions without wanting to despite not being all that new to Emacs, and I'm glad it warns me instead of running weird commands.

Adbot
ADBOT LOVES YOU

emoji
Jun 4, 2004
Just helm-M-x everything.

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
In the videos for Emacs Rocks, what feature is he using to show where the file ends? It's a grey line along the left of the buffer where other editors would put line numbers. Actually, it would be below where the line numbers stop in other editors.



Any other cool modes you emacs masters run that do little tweaks like this?

orphean
Apr 27, 2007

beep boop bitches
my monads are fully functional

PlesantDilemma posted:

In the videos for Emacs Rocks, what feature is he using to show where the file ends? It's a grey line along the left of the buffer where other editors would put line numbers. Actually, it would be below where the line numbers stop in other editors.



Any other cool modes you emacs masters run that do little tweaks like this?

That area is called "the fringe" just to help you find stuff about it in the future. If you want those empty indicators in every buffer slap the following somewhere in your init files:
code:
(setq default-indicate-empty-lines t)
As for tips and tricks, ummm, I kinda like using powerline to make my mode line look a bit prettier.

Edit:
Just to add to this the two biggest things you can do to make emacs look a lot better is a) use a decent font and make sure you're using a build that can antialias the fonts (any recent), and b) use a nice color scheme. More advanced would be hiding the menu (and scroll bars honestly).

And a general list of 'modes' that I like:
  • ace-jump-mode
  • ace-jump-buffer-mode
  • ace-jump-window-mode (highly recommended if you work with multiple emacs windows. If you're not familiar with Emacs Jargon 101 windows in this case are what you'd call frames or panels in any other app. Emacs calls what you think of as windows, frames. Yay.
  • winner-mode
  • helm

orphean fucked around with this message at 23:36 on Sep 15, 2014

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace

orphean posted:

(setq default-indicate-empty-lines t)

Thanks buddy I really like seeing where my files end for some reason. I eval-ed this and immediately smiled. The more I think about how emacs lets your play with the global environment the more it seems like emacs should be more of a chaotic mess than it is. Instead it's a powerhouse of productivity and fun :D

Thanks for the list of modes to try out. I think I'll explore Helm next. It looks like a more advanced version of ido. I get tons of use out of ido so improving that sounds like a great idea.

I recently installed company mode thinking I would have to muck around with backends before I got it useable and I am super happy to see that I didn't have to install anything besides the base package before it was very usable. By default it works similar to Sublime text where it will just pull words from the current file as suggestions. All emacs noobies like me should give it a shot as an easy way to get auto-completion going!

Also, nzenburn is the best theme I have found so far, but the built in tango-dark theme is also very nice.

Everyone else should post more about emacs :colbert:

pgroce
Oct 24, 2002
Company is miraculous. You don't need back ends to get some great use out of it, but back ends are largely not your problem, either; package and mode maintainers seem to do what's needed in my experience, without me having to fiddle with much. (IDE-like stuff like CIDER and elpy need the hand-holding to start an inferior process, but after that the completion comes "for free.") So much win.

Surprise T Rex
Apr 9, 2008

Dinosaur Gum
So I grabbed Emacs yesterday after getting frustrated with the poor state of Python Autocompletion in Sublime Text compared to C#'s IntelliSense in VS2013. I sort of came into it with the mindset of "Well I'll pick either Emacs or Vim to have a go at learning, and if I can't wrap my head around it then I'll give in and keep going with ST3."

Last night I felt like I might be about to give in, but I loaded it up at work today and just casually opened up my .emacs, took out the scroll and toolbars, saved it and had a look around the buffer menu and stuff, without needing to think too much. It's... not easy, I guess, just not quite as incomprehensible as I first thought it might be.

It got a lot easier too when I gave up on using the C-[whatever] shortcuts to move the point and just went back to 'proper' keyboard cursor movement.

Hollow Talk
Feb 2, 2014

Surprise T Rex posted:

So I grabbed Emacs yesterday after getting frustrated with the poor state of Python Autocompletion in Sublime Text compared to C#'s IntelliSense in VS2013. I sort of came into it with the mindset of "Well I'll pick either Emacs or Vim to have a go at learning, and if I can't wrap my head around it then I'll give in and keep going with ST3."

Last night I felt like I might be about to give in, but I loaded it up at work today and just casually opened up my .emacs, took out the scroll and toolbars, saved it and had a look around the buffer menu and stuff, without needing to think too much. It's... not easy, I guess, just not quite as incomprehensible as I first thought it might be.

It got a lot easier too when I gave up on using the C-[whatever] shortcuts to move the point and just went back to 'proper' keyboard cursor movement.

Give it time. People's .emacs configs tend to evolve over time (it never ends! :saddowns:). Do use whatever feels most natural, be it things like CUA Mode, cursor movement or some such. Be prepared to also get told years and years into using it about package x or y, which will magically solve a problem you've had, a hack you've been using or just make everything easier, making you question how you ever managed to live without it.

At least installing packages has become easier with M-x list-packages...

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
Emacs is getting some discussion these days. Stackoverflow is making an emacs specific Q&A site. Also the Emacs mailing list is talking about just sticking with elisp instead of trying to get Guile scheme integrated. I know elisp isn't very well regarded as a modern programming language. I'm hoping to eventually learn elisp so I can make cool modes for emacs, but if the language is going to change in new versions or switch to Guile then maybe I should put off my studying.

Surprise T Rex posted:

It got a lot easier too when I gave up on using the C-[whatever] shortcuts to move the point and just went back to 'proper' keyboard cursor movement.

Are you talking about using arrow keys instead of like C-f to move right? Because forget that crap I'm arrow keys for life. Anyway, emacs is all about setting up the system to be easy for you so if you decide not to do C-[whatever] then that is a valid choice.

Notorious b.s.d.
Jan 25, 2003

by Reene

PlesantDilemma posted:

I know elisp isn't very well regarded as a modern programming language. I'm hoping to eventually learn elisp so I can make cool modes for emacs, but if the language is going to change in new versions or switch to Guile then maybe I should put off my studying.

elisp, as a language, is not all that complicated. It's just a very 1980s lisp dialect. If you know any other lisp, elisp will be very familiar and only a little bit frustrating.

What takes time is learning the Emacs APIs, implicit and explicit. Even in a world where they migrated to a more modern runtime, most of that material would remain the same.

Lastly, I would be very surprised if we ever escaped elisp. People have been talking about Guile or CL-based Emacs for 20 years, and it hasn't happened yet.

aerique
Jul 16, 2008

Surprise T Rex posted:

So I grabbed Emacs yesterday after getting frustrated with the poor state of Python Autocompletion in Sublime Text compared to C#'s IntelliSense in VS2013. I sort of came into it with the mindset of "Well I'll pick either Emacs or Vim to have a go at learning, and if I can't wrap my head around it then I'll give in and keep going with ST3."

For Python completion I use Jedi (https://github.com/davidhalter/jedi) and for syntax checking I use Flycheck (https://github.com/flycheck/flycheck).

Try out Jedi.el first. I personally use anaconda-mode because I use company-mode as my generic completer but I recall Jedi.el to be easier to setup initially.

There's also a couple of all-in-one Python packages for Emacs. I tend not to like such solutions but to each his own: http://www.emacswiki.org/emacs/PythonProgrammingInEmacs#toc2

Surprise T Rex posted:

Last night I felt like I might be about to give in, but I loaded it up at work today and just casually opened up my .emacs, took out the scroll and toolbars, saved it and had a look around the buffer menu and stuff, without needing to think too much. It's... not easy, I guess, just not quite as incomprehensible as I first thought it might be.

Yeah, like others already said gently caress that poo poo. I don't use hjkl in Vim much either: touch typists ain't got swag.

Seriously, maybe it's because I did a lot of swimming when I was younger but the homerow, touch typist position has always felt very cramped when I tried it. I keep my hands floating at the sides of the keyboard near WASD and the arrow keys so I have no problem using the arrow keys and Ins / Del / Home / End / PgUp / PgDn.

Surprise T Rex
Apr 9, 2008

Dinosaur Gum
Yeah, okay. I'm hooked. I don't know why I like it so much, but I'm actively looking for reasons to use Emacs over other programs where I can, now. Partly to learn it more, partly just because what I already know is awesome. Not had a chance to use it for Python yet, but I've got it set up properly now so I can have a go later on at trying to work on a Django site I'm developing, so we'll soon find out how that goes.

I think I might be one of those people.

Tetraptous
Nov 11, 2004

Dynamic instability during transition.
Yeah, I pretty much work in emacs all day long. As they say, it's a great operating system lacking only in a decent text editor. :v:

My job doesn't even involve that much programming.

jony neuemonic
Nov 13, 2009

Hello Emacs friends.

I've just ported my Vim setup almost entirely over to Emacs/Evil and it's great except for two minor things:

I keep an Exuberant Ctags file in my .git directories that's updated with Git hooks on commit/checkout. Vim would automatically pick that up thanks to some magic in the Fugitive plugin and use it for navigation and completion. Is there any way to have Emacs automatically grab it? (I've already updated the Git hook to generate an Emacs compatible tags file, and selecting it manually works).

In Vim I had the tab key remapped to send tab if the cursor was beside a line beginning or whitespace character, and call a completion function otherwise. Should that be possible to duplicate?

On a less Vimmy note, does anyone in the thread use Ensime for Scala dev? I've been using it and it's great, but I'm kind of surprised that there's nothing in the command list about evaluating code from another buffer in a REPL. That's a killer feature of CIDER and the thing that got me into using Emacs.

Notorious b.s.d.
Jan 25, 2003

by Reene

fidel sarcastro posted:

Hello Emacs friends.

I've just ported my Vim setup almost entirely over to Emacs/Evil and it's great except for two minor things:

I keep an Exuberant Ctags file in my .git directories that's updated with Git hooks on commit/checkout. Vim would automatically pick that up thanks to some magic in the Fugitive plugin and use it for navigation and completion. Is there any way to have Emacs automatically grab it? (I've already updated the Git hook to generate an Emacs compatible tags file, and selecting it manually works).
CEDET is the normal way to interact with ctags from emacs. I believe CEDET supports the "exuberant-ctags" format but I don't use either one, so I can't give you more than that.

fidel sarcastro posted:

In Vim I had the tab key remapped to send tab if the cursor was beside a line beginning or whitespace character, and call a completion function otherwise. Should that be possible to duplicate?
Most major modes will just Do The Right Thing with tabs and completion. It should be fixable pretty easily otherwise.

fidel sarcastro posted:

On a less Vimmy note, does anyone in the thread use Ensime for Scala dev? I've been using it and it's great, but I'm kind of surprised that there's nothing in the command list about evaluating code from another buffer in a REPL. That's a killer feature of CIDER and the thing that got me into using Emacs.
Ensime is unfinished, but its principal author has stepped back from active development. If you write something to get this done, he'll probably accept your PR, but I don't expect to see new features from him otherwise.

pgroce
Oct 24, 2002

fidel sarcastro posted:

In Vim I had the tab key remapped to send tab if the cursor was beside a line beginning or whitespace character, and call a completion function otherwise. Should that be possible to duplicate?

Note that in most language modes Emacs uses tab differently from Vim. Instead of inserting a tab (or n spaces) , it will try to "do the right thing" with indentation. This is usually pretty nice (you hit tab once and the line automagically snaps to the right indentation level), but if you want Vim-style control or you want to insert white space in the middle of a line, you're fighting the Emacs convention.

Not saying you can't do it. But you'll likely have to fight it every time you use a new language mode. It'll be an uphill fight.

jony neuemonic
Nov 13, 2009

Thanks for the Ctags and completion tips, guys. I'll do some tinkering.

Notorious b.s.d. posted:

Ensime is unfinished, but its principal author has stepped back from active development. If you write something to get this done, he'll probably accept your PR, but I don't expect to see new features from him otherwise.

That's too bad. Hopefully it gets picked back up, it's been just the right amount of IDE power without jumping to something as heavy as Eclipse.

e. Turns out sbt-mode actually does what I was looking for:

quote:

You can also send a region of code from an other buffer in the same project. First set the mark to the other end of the region to send and the point (cursor) the other. Then run the M-x sbt-send-region command. The command will skip any whitespace or comments at the beginning and end of the region.

jony neuemonic fucked around with this message at 17:57 on Sep 21, 2014

aerique
Jul 16, 2008

fidel sarcastro posted:

I keep an Exuberant Ctags file in my .git directories that's updated with Git hooks on commit/checkout. Vim would automatically pick that up thanks to some magic in the Fugitive plugin and use it for navigation and completion. Is there any way to have Emacs automatically grab it? (I've already updated the Git hook to generate an Emacs compatible tags file, and selecting it manually works).

I think I've seen a page on the EmacsWiki about updating tags on saving the buffer but I haven't used it myself (yet, I've been meaning to).

Ah, here. Not quite what I thought it was but hopefully some inspiration for your first elisp project ;-) http://www.emacswiki.org/emacs/GnuGlobal#toc3

fidel sarcastro posted:

In Vim I had the tab key remapped to send tab if the cursor was beside a line beginning or whitespace character, and call a completion function otherwise. Should that be possible to duplicate?

Yes, there's a couple of solutions. Check this page which seems to have grown since the last time I checked it: http://www.emacswiki.org/emacs/TabCompletion

I've used Smart Tab for a while but thought it too complex for what it was supposed to do. For now I'm using my own solution (pasted below) but perhaps I should check out the new entries on that page.

code:
;; I wasn't really happy with how Smart Tab worked and its complexity, so I reinvented the wheel
;; which does what is intuitive to /me/.  It will have issues for people not used to it.
(setq tab-overload-completion-function #'company-complete)
(setq tab-overload-debug nil)

(defun tab-overload-complete ()
  "Complete according to current major mode."
  (interactive)
  (when tab-overload-debug
    (message "  tab-overload-complete"))
  (funcall tab-overload-completion-function))

(defun tab-overload-indent ()
  "Indent region if mark is active, or current line otherwise."
  (interactive)
  (when tab-overload-debug
    (message "  tab-overload-indent")
    (message "  use-region-p: %s; bolp: %s; string-match(%s): \"%s\" <<%s>>"
             (use-region-p) (bolp)
             (string-match "[[:space:]]" (string (preceding-char)))
             (string (preceding-char)) (preceding-char)))
  (if (use-region-p)
      (indent-region (region-beginning) (region-end))
      (indent-for-tab-command)))

(defun tab-overload ()
  (interactive)
  (when tab-overload-debug
    (message "tab-overload"))
  (if (or (use-region-p)
          (bolp)
          (string-match "[[:space:]]" (string (preceding-char))))
      (tab-overload-indent)
      (tab-overload-complete)))

(define-key evil-insert-state-map (kbd "<tab>") 'tab-overload)
(define-key evil-visual-state-map (kbd "<tab>") 'tab-overload)

Catalyst-proof
May 11, 2011

better waste some time with you
The Emacs Stackoverflow is in beta, which is good. It seems to only be restricted to the people who voted for it, which is goddamned loving retarded.

aerique
Jul 16, 2008

horse mans posted:

The Emacs Stackoverflow is in beta, which is good. It seems to only be restricted to the people who voted for it, which is goddamned loving retarded.

If there's questions you want asked on there you can ask them through me. It's mostly about traffic currently to get the from beta to official.

Catalyst-proof
May 11, 2011

better waste some time with you

aerique posted:

It's mostly about traffic currently to get the from beta to official.

Exactly. So why wouldn't they open it up to everyone in order to increase chances the traffic reaches that point?

aerique
Jul 16, 2008

horse mans posted:

Exactly. So why wouldn't they open it up to everyone in order to increase chances the traffic reaches that point?

I have no clue. I was just offering a way to add to the traffic if you want the site to become official.

Surprise T Rex
Apr 9, 2008

Dinosaur Gum
Org-mode is fantastic. It's brilliant for whipping up quick internal documentation and stuff. Write it out in loose bullet points, add headings, C-c, C-e, h. You have a formatted HTML page, if a little bare-looking.

If you haven't made good use of it yet you really need to.

Hollow Talk
Feb 2, 2014

Surprise T Rex posted:

Org-mode is fantastic. It's brilliant for whipping up quick internal documentation and stuff. Write it out in loose bullet points, add headings, C-c, C-e, h. You have a formatted HTML page, if a little bare-looking.

If you haven't made good use of it yet you really need to.

You can style the html it generates with css and even with javascript, though. That might at least help a bit with the bareness: http://orgmode.org/manual/CSS-support.html#CSS-support

If you find yourself using it more often like that, have a look at the Publishing module (http://orgmode.org/manual/Publishing.html#Publishing) as well. It lets you define "projects" and can format the html and copy it elsewhere, together with images, stylesheets etc.

I practically live in org-mode, since I use that for all of my notes (and Emacs+LaTeX+RefTeX for writing), and it really is fantastic!

jony neuemonic
Nov 13, 2009

aerique posted:

Awesome info.

Bit late on this one, but thanks for the detailed reply!

Sounds like I need to give Org-Mode a try, I do have an awful lot of documentation that needs writing...

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
Just used tramp mode for the first time and it's amazing. On my linux box it works great without extra setup and I'm anxious to setup putty so I can remotely edit and browse folders from my windows 7 emacs install.

But I'm confused as to if it is keeping a connection open for a long time or just making connections as needed? When I close a file and all the dired buffers, does that close the ssh connection? I also see a tramp-cleanup-all-connections function, do I need to call that with M-x when I am done?

orphean
Apr 27, 2007

beep boop bitches
my monads are fully functional

PlesantDilemma posted:

Just used tramp mode for the first time and it's amazing. On my linux box it works great without extra setup and I'm anxious to setup putty so I can remotely edit and browse folders from my windows 7 emacs install.

But I'm confused as to if it is keeping a connection open for a long time or just making connections as needed? When I close a file and all the dired buffers, does that close the ssh connection? I also see a tramp-cleanup-all-connections function, do I need to call that with M-x when I am done?

It depends, it does both. If you're worried about leaving them open then cleaning them up now and then doesn't hurt. There are a few functions available for that (in addition to the one you found): https://www.gnu.org/software/emacs/manual/html_node/tramp/Cleanup-remote-connections.html

Another neat thing to do with tramp is use it to get elevated privileges locally to edit root owned files or whatever.

code:
C-x C-f
/sudo::/path/to/file

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
org-mode question:

I'm cleaning up my org file, and I find that I am in need of a way to mark all items in a subtree as DONE. So I have something like this:

code:
* TODO Build Debug Tool [1/4]
** DONE talk with boss
** TODO setup IDE
** TODO build the stupid thing
** TODO write docs
I'm all done with everything. Is there a way to have my cursor on the first line and mark all the TODO items as DONE? I'm looking through the docs and I dont see anything. One thing I'm doing to speed up is to use multiple-cursors and put a cursor on every TODO item, then I can C-c C-t them all to DONE easily.

Also, I like having
code:
#+SETQ_TODO: TODO WAITING | DONE CANCEL
for my todo cycle. I find a lot of stuff has to be put on hold or will be planned but then dropped so I mark a lot of stuff as CANCEL.

Anyway that's my org-mode tip, what's everyone else doing to make org-mode even more awesome than it already is?

pgroce
Oct 24, 2002
That's clever. I think my first instinct would be to dig into the arcane buffer traversal functions in org-mode and write a command that cycles everything in the subtree under point to DONE.

I'm not recommending this, more pointing out how the way I use org-mode is actually bad for my productivity. :)

e: BTW, http://emacs.stackexchange.com/ is now out of beta. A goldmine of weird Emacs tips awaits!

aerique
Jul 16, 2008
I've put my own Emacs theme online which is a little bit different from most themes: the point is not so much to highlight every syntax under the sun, but use the highlighting to partition the source in easily scannable pieces: https://github.com/aerique/emacs-theme-aerique

I've always found themes that highlight too much, distracting and to not offer much above no syntax highlighting at all. Not too mention the colors are often too intense. So the theme just highlights the usual suspects like comments and strings (which are often a source of errors when not closed).

It isn't really ready for public consumption yet though since it has an issue: it needs to be loaded twice. This is probably due to the theme inheriting from its own definitions. Does anyone have an elegant solution to this without putting variable names for custom colors in the global namespace?

jony neuemonic
Nov 13, 2009

aerique posted:

I've put my own Emacs theme online which is a little bit different from most themes: the point is not so much to highlight every syntax under the sun, but use the highlighting to partition the source in easily scannable pieces: https://github.com/aerique/emacs-theme-aerique

I've always found themes that highlight too much, distracting and to not offer much above no syntax highlighting at all. Not too mention the colors are often too intense. So the theme just highlights the usual suspects like comments and strings (which are often a source of errors when not closed).

It isn't really ready for public consumption yet though since it has an issue: it needs to be loaded twice. This is probably due to the theme inheriting from its own definitions. Does anyone have an elegant solution to this without putting variable names for custom colors in the global namespace?

This looks really great, I'm glad someone is exploring the middle ground between no highlighting at all and rainbow vomit.

Catalyst-proof
May 11, 2011

better waste some time with you
So Emacs 24.4 is out. Great. There's a bunch of new features, but one caught my eye: eww, a new web browser. Turns out it's... not really good.



Here's an input field. If I run delete-horizontal-space, guess what happens to this input field?



If you guessed 'it loving disappears', congratulations!

Here's a password field. I'm going to type some text, and then run delete-horizontal-space. Keep in mind this is equivalent to typing your password into a shorter input field.




Now I continue typing my password.



Great

dobbymoodge
Mar 8, 2005

horse mans posted:

So Emacs 24.4 is out. Great. There's a bunch of new features, but one caught my eye: eww, a new web browser. Turns out it's... not really good.

I think the name eww was chosen intentionally, i.e. the author knows it is terrible. That said, I don't understand why it's included in 24.4, but I haven't researched the reasoning behind the decision either. :shrug:

pgroce
Oct 24, 2002
Eww was written by the Gnus maintainer out of Code he wrote for displaying HTML mail messages. It's still pretty new for general browsing.

Pham Nuwen
Oct 30, 2010



pgroce posted:

Eww was written by the Gnus maintainer out of Code he wrote for displaying HTML mail messages. It's still pretty new for general browsing.

That would explain it, once you have your foot in the door with some previous contributions, it's a lot easier to get whatever crap you want in. See: Lennart Poettering

pgroce
Oct 24, 2002
Coincidentally, SystemD is a bit like that old joke about Emacs being a suitable replacement for sysvinit.

Except it won't work as well. :smug:

Catalyst-proof
May 11, 2011

better waste some time with you

kraftwerk singles posted:

Just helm-M-x everything.

Holy gently caress. I just installed helm for the first time. It's amazing. Soaked up a ton of useful info from this tutorial.

tak
Jan 31, 2003

lol demowned
Grimey Drawer
Just made a new helm-testing branch for my .emacs.d git repo, I'm pretty used to ido-ubiquitous-mode and ido-everywhere-mode though. I did some reading and it seems that the recommended way of doing both ido and helm is to globally enable helm and add ido wherever you prefer it. Anyone use both? Is it worth sticking with ido in general?

aerique
Jul 16, 2008

tak posted:

the recommended way of doing both ido and helm is to globally enable helm and add ido wherever you prefer it. Anyone use both? Is it worth sticking with ido in general?

I don't really see the point of using both. I used ido + smex for quite a while before helm got on the radar and I switched to the latter two years ago.

Adbot
ADBOT LOVES YOU

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.
Does anyone happen to use rvm.el for ruby gemsets? I have having a hard time getting to to switch things properly when I am using the shell. All the info I have been finding out there is talking about launching IRB from a corresponding ruby file, but I just want to run it from an emacs shell.

  • Locked thread