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
tak
Jan 31, 2003

lol demowned
Grimey Drawer
probably C:\Windows\system32\drivers\etc\hosts

Adbot
ADBOT LOVES YOU

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

tak posted:

probably C:\Windows\system32\drivers\etc\hosts

Unfortunately, for plink it's not that simple, since plink's session names (which emacs uses for the host name part of the TRAMP path) aren't necessarily related to the server's host name; they're just arbitrary names you type into putty. They're also stored in the Windows registry, but I think you can make them be stored in a file instead.

tak
Jan 31, 2003

lol demowned
Grimey Drawer
Ahh, right. Well, I'm not sure what else you could try, I don't have much experience with using plink with tramp-mode. Is using openssh for tramp-mode an option (via cygwin)? That might be easier in the end.

You should be able to put ssh.exe and cygwin1.dll in the emacs bin directory to get that to work without messing with the rest of your environment.

brae
Feb 2, 2006
I have a Windows 8 VM and was able to write some elisp that grabs hostnames from the registry where Putty stores them (after Google told me where that was).

Here's a gist. I wasn't able to get tramp configured to hook in the completion there, but you could try this function out in emacs to see what it returns for you and maybe try hooking it into tramp's completion.

Pham Nuwen
Oct 30, 2010



Emacs is pretty cool but this is a dumb thing to do: http://www.howardism.org/Technical/Emacs/new-window-manager.html since you could do all the same poo poo by running xmonad or whatever, at least that would let your Firefox windows go full-screen and allow you to switch between browser and emacs without closing the browser every time.

I think his eshell-here thing is pretty neat though: http://www.howardism.org/Technical/Emacs/eshell-fun.html

It's inspired me to try integrating eshell and dired a bit more rather than relying on external xterms all the time.

wooger
Apr 16, 2005

YOU RESENT?

Pham Nuwen posted:

Emacs is pretty cool but this is a dumb thing to do: http://www.howardism.org/Technical/Emacs/new-window-manager.html since you could do all the same poo poo by running xmonad or whatever, at least that would let your Firefox windows go full-screen and allow you to switch between browser and emacs without closing the browser every time.

I think his eshell-here thing is pretty neat though: http://www.howardism.org/Technical/Emacs/eshell-fun.html

It's inspired me to try integrating eshell and dired a bit more rather than relying on external xterms all the time.

Saw that first link the other day on HackerNews. This guy is a bit OTT, but I like the concept. I just have a workspace / monitor dedicated to emacs fullscreen, and use that for all text & shell work, with browsers / office tools / gui stuff elsewhere. Any workspace enabled window manager is fine though.

I use emacs on Windows at work, in lieu of a proper Unix environment, and use the msys GNU tools (they come with Git) + eshell + tramp to accomplish most things. It's not ideal, but it works. For the guys above messing with putty, plink & trump, I'd definitely recommend switching to proper OpenSSH and spending a little while making a nice ssh.conf.

Reading the comments there, I did find an interesting new emacs addon /alternative distribution called Spacemacs. https://github.com/syl20bnr/spacemacs

"Spacemacs is a user-friendly and well-documented Emacs kit that integrates the best Emacs packages out there. It uses Evil Mode to combine the ergonomic editing features of Vim with the extensibility of Emacs."

As an exclusive evil-mode user, this really looks like it could be of value, though I've only just started playing around really. I get the sense that they've bundled a few too many tools by default.

I only switched from vim a year or two back, but my init.el has a bunch of stuff in it.

Oddly, Spacemacs arrives at a very similar solution to my own one to enhance ergonomics:
They use vim leader to make all commands accessible via a press on the space bar.

In my init.el: In evil normal mode, the space bar sends C-x, and the ; key sends M-x.

So combined with evil, I almost never have to chord.

Grim Up North
Dec 12, 2011

wooger posted:

"Spacemacs is a user-friendly and well-documented Emacs kit that integrates the best Emacs packages out there. It uses Evil Mode to combine the ergonomic editing features of Vim with the extensibility of Emacs."

For me as someone who has only worked with Vim and always kinda enviously looked at all the cool Emacs modes, Spacemacs really made the switch easy. I love it.

Hollow Talk
Feb 2, 2014

wooger posted:

As an exclusive evil-mode user, this really looks like it could be of value, though I've only just started playing around really. I get the sense that they've bundled a few too many tools by default.

I get the feeling that usually fits most of these bundles (oh-my-zsh is another one that comes to mind). I like to have a look at them and see how they solve particular problems, and I tend to find an interesting or useful solution to a problem I have as well (or that I didn't even know I have had until then :saddowns:); yet there are always so many things in there that seem counterintuitive, that I would never use or which I don't understand which make me hesitant to "just use" them.

midnightclimax
Dec 3, 2011

by XyloJW
If I put (toggle-scroll-bar -1) in my .emacs on my mac, emacs starts freaking out. Files not displayed properly, a second window bar pops up in the center of the buffer, etc.
Is that function obsolete, or is it just a bug? I'm usually in org-mode, so maybe that's related, dunno.

Catalyst-proof
May 11, 2011

better waste some time with you

midnightclimax posted:

If I put (toggle-scroll-bar -1) in my .emacs on my mac, emacs starts freaking out. Files not displayed properly, a second window bar pops up in the center of the buffer, etc.
Is that function obsolete, or is it just a bug? I'm usually in org-mode, so maybe that's related, dunno.

I'm not sure about the use of that function; I'd just customize the value of scroll-bar-mode (nil for no scroll bars).

midnightclimax
Dec 3, 2011

by XyloJW

horse mans posted:

I'm not sure about the use of that function; I'd just customize the value of scroll-bar-mode (nil for no scroll bars).

Using that I get exactly the same display errors.

Catalyst-proof
May 11, 2011

better waste some time with you

midnightclimax posted:

Using that I get exactly the same display errors.

Then I imagine it's not the scroll-bar which is the problem. Try removing things from your init.el to see if you can narrow it down, or try remove the scrollbar after emacs -Q to see what happens with no custom packages or elisp loaded.

Hollow Talk
Feb 2, 2014
It might also help to enable debugging via (setq debug-on-error t), just to see whether something obviously throws an error right that moment.

https://www.gnu.org/software/emacs/manual/html_node/elisp/Error-Debugging.html

fishbacon
Nov 4, 2009
wonderful yet strange smell
You could try:

Lisp code:
(if (boundp 'scroll-bar-mode) (scroll-bar-mode -1))
edit: that will actually probably not work come to think of it.

midnightclimax
Dec 3, 2011

by XyloJW

Hollow Talk posted:

It might also help to enable debugging via (setq debug-on-error t), just to see whether something obviously throws an error right that moment.

https://www.gnu.org/software/emacs/manual/html_node/elisp/Error-Debugging.html

Hmm well that didn't show anything. Unless it outputs to some file I can't find.


horse mans posted:

Then I imagine it's not the scroll-bar which is the problem. Try removing things from your init.el to see if you can narrow it down, or try remove the scrollbar after emacs -Q to see what happens with no custom packages or elisp loaded.

Ok I'll try that later.

Hollow Talk
Feb 2, 2014

midnightclimax posted:

Hmm well that didn't show anything. Unless it outputs to some file I can't find.

Hmpf, that's interesting. Errors bring up a new frame with debugging enabled, so you didn't miss anything. :(

midnightclimax
Dec 3, 2011

by XyloJW
Ok, figured it out.
(if (window-system) (set-frame-size (selected-frame) 90 50))
caused the problem, since the 50 went over the dock, only it didn't show. It looked like it stopped before the dock. So I reduced it to 45, and voila, everything works. What a dumb bug.

midnightclimax
Dec 3, 2011

by XyloJW
If I have a vertical window split, file on the left, bookmark list on the right, is it possible to navigate through the bookmarks, but only open them in the left pane?

midnightclimax
Dec 3, 2011

by XyloJW
I'm currently playing around with Icicles, which makes me wonder, are there any libraries that you would consider essential?

aerique
Jul 16, 2008

midnightclimax posted:

I'm currently playing around with Icicles, which makes me wonder, are there any libraries that you would consider essential?

You might want to check out helm before investing too much time in Icicles.

pgroce
Oct 24, 2002
If you write any elisp, there's really no reason IMO not to use s.el and dash.el.

There are a million replacements for the default "find files/buffers" behavior (particularly ido and helm), but which of those replacements is best is a personal/religious choice. I always change the default behavior, however, even if only to use iswitchb (er, I guess Icomplete now.)

midnightclimax
Dec 3, 2011

by XyloJW
Ok, checked out helm. Pretty cool, shelving icicles for now.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

brae posted:

I have a Windows 8 VM and was able to write some elisp that grabs hostnames from the registry where Putty stores them (after Google told me where that was).

Here's a gist. I wasn't able to get tramp configured to hook in the completion there, but you could try this function out in emacs to see what it returns for you and maybe try hooking it into tramp's completion.

Sorry for taking so long to reply, but this is definitely a good start. I haven't gotten it working yet either, but this at least points me in the right direction. If I figure it out, maybe I can host it on MELPA or something...

EDIT: Ok, this is really weird. It looks like emacs already has support for autocompletion for plinkx via tramp-parse-putty, but it's not working for some reason...

EDITx2: So far, I've narrowed the issue down to (find-file-name-handler "/" 'file-name-all-completions) returning nil on Windows, but tramp-completion-file-name-handler on Linux.

Avenging Dentist fucked around with this message at 00:10 on Feb 13, 2015

duck hunt
Dec 22, 2010
I'm to the place in my Emacs learning that I never use the arrow keys on my keyboard. The built in tutorial is really good! Its so bad that I'm trying to use emacs chords right now to move the cursor around.

I primarily work in Python right now, can you guys suggest some Python resources for Emacs or point me in towards the next thing to learn like multi-file editing?

pgroce
Oct 24, 2002
Check elpy out if you haven't already. Some of what it does is IDE-ish (e.g., code completion via Company) but you don't have to use that. I like using the flymake integration (via pyflakes) to spot obvious errors before I start running the code, and loading my buffer automatically into a Python REPL buffer so I can play around and understand just what my code is doing as I write it.

If you don't need any of that, the regular python-mode is reasonable enough. Indentation modes for whitespace-delimited languages tend to be awful; python-mode is merely meh. :)

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

Ok, I finally figured it out: emacs on Windows takes a "/" and converts it to a Windows-style path (e.g. "C:/"), which TRAMP tries to detect with a regexp in file-name-handler-alist, but the regexp is wrong. Replacing it like so gives me autocompletion of host names:

code:
(setf (car (rassoc 'tramp-completion-file-name-handler
                   file-name-handler-alist))
      "\\`.:/[^/]*\\'")
Next up, figuring out how to expand paths from the server without having to explicitly connect to it first. (e: If anyone knows how to do that, or if it's even possible, let me know.)

Avenging Dentist fucked around with this message at 05:30 on Feb 13, 2015

duck hunt
Dec 22, 2010

pgroce posted:

Check elpy out if you haven't already. Some of what it does is IDE-ish (e.g., code completion via Company) but you don't have to use that. I like using the flymake integration (via pyflakes) to spot obvious errors before I start running the code, and loading my buffer automatically into a Python REPL buffer so I can play around and understand just what my code is doing as I write it.

If you don't need any of that, the regular python-mode is reasonable enough. Indentation modes for whitespace-delimited languages tend to be awful; python-mode is merely meh. :)

This is awesome! Wow, thanks so much for the help. Is the process the same for adding similar functionality for other languages, or is Python special because, well, its Python and everyone loves it?

pgroce
Oct 24, 2002

duck hunt posted:

This is awesome! Wow, thanks so much for the help. Is the process the same for adding similar functionality for other languages, or is Python special because, well, its Python and everyone loves it?

I don't know how well I'm answering your question, but here's a big long effortpost about programming language support in Emacs. :)

Language support isn't very standard in Emacs, but there are commonalities. You'll see company mode and flycheck support for a lot of different languages, for instance.

The main way Emacs offers language support is as major modes. Almost every language has a major mode either built-in or easily installable from the internet. What they do and how useful they are varies a lot. When you first use a mode, type C-h m (or M-x describe-mode) and read over its documentation and the keys it describes. There are often lots of good features there that you didn't know about.

Several projects take Elpy's general approach -- that is, start a subprocess running the language interpreter and get language-specific information from there. AFAIK, the first was SLIME, which did it for non-Emacs lisps. (It was trying to make Emacs as friendly to other lisps as it was to elisp itself, so maybe you can say elisp came first.) CIDER does this for Clojure, and it's awesome. I googled around and found analogous projects for Ruby and Perl, but I don't know what their quality is like. They'd all be fairly different to install, configure and use, however. SLIME is a giant PITA, for instance.

Other packages take totally different approaches. CEDET, for C++, is largely it's own thing. At the other end of the spectrum is stuff like Skewer.

Finally: Most of the time you don't need all this crap. :) And trying to keep all the parts moving can be more effort than it's worth. For that reason, I suggest you start with the minimal tooling Emacs gives you, and ramp things up as things annoy you. Getting pissed at something and changing it is the Emacs way.

aerique
Jul 16, 2008

duck hunt posted:

Is the process the same for adding similar functionality for other languages, or is Python special because, well, its Python and everyone loves it?

It different for each language.

Notorious b.s.d.
Jan 25, 2003

by Reene
There are a ton of these projects to talk down a pipe to a language-specific process. They're usually minor modes, rather than major modes. SLIME is an exception to that rule, if i recall correctly

For example, in ruby, there is a major mode to handle syntax highlighting and indentation (enh-ruby-mode), then a minor mode (robe-mode) to talk down a pipe to get completion and code re-loading and so on.

You should always be using the major mode for every language -- there's pretty much no cost/effort. The minor modes are more effort to set up, but they get you more IDE-like features: code analysis, completion, refactoring

The ones I use on a regular basis:
  • Ruby

    enh-ruby-mode -- major
    robe-mode -- minor

  • Perl

    cperl-mode -- major, built into emacs
    Sadly, I don't have a minor mode to provide perl reflection.

  • Scala

    scala-mode2 -- major
    ensime -- minor

  • Java. There are lots of options for java, but this is what I use.

    java-mode -- major, built into emacs
    eclim -- minor

Notorious b.s.d. fucked around with this message at 19:59 on Feb 14, 2015

pgroce
Oct 24, 2002

This is pretty good stuff. I wonder if some of this could get shifted into the OP? After all, software development is probably the most common use case.

Catalyst-proof
May 11, 2011

better waste some time with you

pgroce posted:

This is pretty good stuff. I wonder if some of this could get shifted into the OP? After all, software development is probably the most common use case.

Can do. Probably should see about cleaning up that terrible post anyway.

Catalyst-proof
May 11, 2011

better waste some time with you
So, for shiggles, I replaced my .emacs.d with Spacemacs, which is meant to provide a set-and-forget vim environment within Emacs.

It's... very painful so far. It's intricately configured and seems to break super easily between revisions, and relies on so many bleeding edge packages that a first run is almost guaranteed to have something not work, which you may or may not be aware of. The navigation scheme for commands is somewhat interesting, though, and it does come packed with a lot of poo poo people should be using in Emacs anyway (helm, projectile, ace, and so on). Has anyone else taken a look at it?

wooger
Apr 16, 2005

YOU RESENT?

horse mans posted:

So, for shiggles, I replaced my .emacs.d with Spacemacs, which is meant to provide a set-and-forget vim environment within Emacs.

It's... very painful so far. It's intricately configured and seems to break super easily between revisions, and relies on so many bleeding edge packages that a first run is almost guaranteed to have something not work, which you may or may not be aware of. The navigation scheme for commands is somewhat interesting, though, and it does come packed with a lot of poo poo people should be using in Emacs anyway (helm, projectile, ace, and so on). Has anyone else taken a look at it?

Yep, see my post up above on this very page. I agree with you I think, I'm back to using my own customised evil-mode, but with space mapped as C-x rather than using it as a vim leader key.

It's way more complicated than vim by default, but may provide some useful ideas of modules to look at.

midnightclimax
Dec 3, 2011

by XyloJW
Talking about adding things to the OP, Planet Emacsen (http://planet.emacsen.org/) is pretty cool if you're just starting out, and want to see what other people are up to.

midnightclimax
Dec 3, 2011

by XyloJW
Eh, I just opened a file and realized I must have cut a large chunk without yanking it someplace else. Guess I need to use some kind of versioning control. I'm using Emacs mostly with org to write memos, journals, etc. Do I just use vc git?

e: Learned about the way emacs does backups, and customized my .emacs accordingly.

midnightclimax fucked around with this message at 12:18 on Feb 22, 2015

Hollow Talk
Feb 2, 2014

midnightclimax posted:

Eh, I just opened a file and realized I must have cut a large chunk without yanking it someplace else. Guess I need to use some kind of versioning control. I'm using Emacs mostly with org to write memos, journals, etc. Do I just use vc git?

e: Learned about the way emacs does backups, and customized my .emacs accordingly.

Regardless, git works great for org files, since they are plain text. The only problem with running "proper" vc on things like org and LaTeX files is that git (like all vc tools I know) works by lines, which is very useful for programming, but sometimes a bit annoying with text. In the end, all it means however is that you get slightly bigger diff files, and git diff --word-diff can highlight changed words rather than whole lines. I don't use much of the emacs git integration, other than the diff viever (vc-diff) and the history viewer, since I do my commits from the console and then write my commit messages in Emacs. It's worth it, though.

tak
Jan 31, 2003

lol demowned
Grimey Drawer
There's no reason not to use magit for git in emacs, IMO. Take an hour or two to read through the documentation or a tutorial or two, you won't regret it. It's very nice for constructing commits hunk-by-hunk, and it gives some handy info when making commit messages that summarize the staged changes about to be committed.

edit:

Notorious b.s.d. posted:

Sadly, I don't have a minor mode to provide perl reflection.

I've been using Devel::PerlySense lately and it's (fairly) good. It doesn't really act like a standard well-behaved minor mode though -- you have to bind its prefix key globally, due to the way it sets up the keymap. Other than that it's pretty nice.

It's the only Perl emacs development environment that seems to be maintained or even working in emacs 24. It's not quite as nice as CEDET/Semantic, but it's better than nothing and does have several things that save a lot of time.

This config seems to be working OK for me (adapted from the Devel::PerlySense docs):

code:
(setq-default
 ps/key-prefix (kbd "C-o")
 ps/load-flymake nil
 ps/external-dir (shell-command-to-string "perly_sense external_dir")
 ps/enable-test-coverage-visualization nil
 ps/use-prepare-shell-command t)

(global-unset-key (kbd "C-o"))
(global-set-key (kbd "C-o C-g") nil)
(global-set-key (kbd "C-o M-g") 'ps/smart-go-to-at-point)

;; add PerlySense external emacs dir to load-path
(if (string-match "Devel.PerlySense.external" ps/external-dir)
    (progn
      (let ((ps-external-emacs-dir (expand-file-name "emacs" ps/external-dir)))
        (message "Adding PerlySense elisp directory `%s' to load-path..."
                 ps-external-emacs-dir)
        (add-to-list 'load-path ps-external-emacs-dir t)))
  (message "Could not identify PerlySense install dir. Is
           Devel::PerlySense installed properly? (`perly_sense
           external_dir' output: %s)" ps/external-dir))

(add-hook 'cperl-mode-hook
          (unless (boundp 'ps/perl-module-at-point)
            (load "perly-sense")))

tak fucked around with this message at 20:58 on Feb 22, 2015

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
Hey I use this line in my .emas to make text bigger:

Lisp code:
(set-face-attribute 'default nil :height 140)
And this works on Windows 7 and Ubuntu. But I got setup with a MacBook at work and this does not make the text bigger when I use Emacs.app. I'm a mac noob so also post tips on using Emacs on mac for me. Thanks!

Adbot
ADBOT LOVES YOU

Deus Rex
Mar 5, 2005

PlesantDilemma posted:

Hey I use this line in my .emas to make text bigger:

Lisp code:
(set-face-attribute 'default nil :height 140)
And this works on Windows 7 and Ubuntu. But I got setup with a MacBook at work and this does not make the text bigger when I use Emacs.app. I'm a mac noob so also post tips on using Emacs on mac for me. Thanks!

This is a stupid question, but have you tried changing the number to be bigger on your Mac (like evaluating:

Lisp code:
(set-face-attribute 'default nil :height 200)
in the scratch buffer), and seeing if it changes? I've noticed font scales are different in Emacs on Mac OS and Linux. The default font size may be different as well.

  • Locked thread