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
Zombywuf
Mar 29, 2008

So working on a hosed Python codebase has lead to me creating this little function:

code:
(defun de-camel ()
  """CamelCaseIsEvilAndMustBeDestroyed"""
  (interactive)
  (while (looking-at "\\w")
    (let ((case-fold-search nil)
	  (c (char-after)))
      (if (char-equal (upcase c) c)
	  (progn
	    (insert "_" (downcase (char-after)))
	    (delete-char 1))
	(forward-char 1)))))

(global-set-key (kbd "C-x C-h") 'de-camel)
Now I can remove camel case in a fraction of the time.

Adbot
ADBOT LOVES YOU

TasteMyHouse
Dec 21, 2006
Is there any facility in emacs (either built in, or through scripting) for comment-aware search? I tried to find that functionality in Vim, and I found some scripts that people had written... didn't work too well. That might be something that would really spur me to use emacs

Catalyst-proof
May 11, 2011

better waste some time with you
Could you be more specific in what you're looking for? Not sure what 'comment-aware search' means.

TasteMyHouse
Dec 21, 2006
I want to be able to search through files using arbitrary regexes, but I want to exclude comments from the search. I also want to be able to search ONLY inside comments, and exclude code. Ideally this would be aware of any style of comment, based on the file extension

code:

C-style /* this is a comment */
C++-style //this is a comment
Python style #this is a comment
Python doc-string style '''this is a comment'''
VB style 'this is a comment
MATLAB style %this is a comment

That kind of thing.

Zombywuf
Mar 29, 2008

TasteMyHouse posted:

I want to be able to search through files using arbitrary regexes, but I want to exclude comments from the search. I also want to be able to search ONLY inside comments, and exclude code. Ideally this would be aware of any style of comment, based on the file extension

It's not ideal, but emacs regexps have escape sequences that match comment delimiters that should work in any language, so you can potentially search using these. Anything more than that requires advanced elisp skills. Well, advanced enough to iterate over comments and run search-forward-regexp on them while dealing with nesting.

Catalyst-proof
May 11, 2011

better waste some time with you
Okay, here's a quick hack. What this does is walk through the output of a buffer like you'd get using M-x rgrep, and applies a filter function on the contents of the matching line to see if it's in a comment. If so, it removes it from the grep results. This is terrible, inefficient code but it gets the job done. It relies on the contents of comment-filter-functions to tell it how to figure out if part of a line of code is in a comment. py-in-comment-p comes with python-mode, which is available in ELPA in Emacs 24. You'd have to write your own predicates for the other modes you use. Then, just M-x rgrep, choose your criteria, then M-x comment-filter-commented-code on the *grep* buffer.

code:

(defconst comment-filter-functions
  '((python-mode . py-in-comment-p)))

(defun comment-get-filter (major-mode)
  (let ((filter-function (assoc major-mode comment-filter-functions)))
    (if filter-function
        (cdr filter-function)
      nil)))

(defun comment-filter-commented-code ()
  "Filter out all search results that exist in commented code."
  (interactive)
  (or (compilation-buffer-p (current-buffer))
      (error "Not in a compilation buffer"))
  (compilation--ensure-parse (point))
  (setq buffer-read-only nil)
  (goto-char (point-min))
  (let (commented-lines)
    (save-excursion
      (condition-case nil
          (while (compilation-next-error 1)
            (if (get-text-property (point) 'compilation-message)
                (let* ((loc (compilation--message->loc (get-text-property (point) 'compilation-message)))
                       (file-struct (compilation--loc->file-struct loc))
                       (lineno (compilation--loc->line loc))
                       (match-string-file-end (let ((beginning (save-excursion (line-beginning-position))))
                                                (next-single-property-change (point) 'font-lock-face nil)))
                       (match-string-column-end (next-single-property-change (1+ match-string-file-end) 'font-lock-face nil))
                       (match-string-match (let ((beginning (save-excursion (goto-char (1+ match-string-column-end)))))
                                             (text-property-any beginning (line-end-position) 'font-lock-face 'match)))
                       (column (- match-string-match match-string-column-end))
                       (filename (car (compilation--file-struct->file-spec file-struct)))
                       (search-line-number (line-number-at-pos)))
                  (goto-line lineno (find-file filename))
                  (goto-char (1- (+ (line-beginning-position) column)))
                  (let ((comment-filter (comment-get-filter major-mode)))
                    (if (and comment-filter (funcall comment-filter))
                          (push search-line-number commented-lines))
                    (bury-buffer)))))
      (error nil)))
    (mapc (lambda (line)
            (goto-line line)
            (kill-line)
            (kill-line)) commented-lines)
    (setq buffer-read-only t)))

etcetera08
Sep 11, 2008

Okay, I figure this thread is as good as any to ask this question, since it's emacs related.

I'm using Aquamacs on OS X 10.5 and I'm trying to set stuff up like this guy for Python + emacs. Most of the stuff worked fine (I think I ran into issues with just ipdb which is probably another question entirely) and I skipped a few of the config steps for now (like I didn't bother installing the python documentation locally). However, I'm not getting IPython to work at all. Whenever I bring up the py-shell it displays the Python 2.5 shell which is the last thing I want. IPython works when I launch it in Terminal and seems to be installed fine to work with Python 3 but for some reason it won't come up in Aquamacs. Both python-mode.el and ipython.el are in my load-path.. I'm not sure what else to try.

Any ideas? Need more info to help?

baby puzzle
Jun 3, 2011

I'll Sequence your Storm.
I tried emacs on osx and there was this enormous toolbar that I couldn't hide. How do you not have that thing?

Also the fonts were all gross and the method of configuring them was a thousand times harder than it needed to be.

Zombywuf
Mar 29, 2008

baby puzzle posted:

I tried emacs on osx and there was this enormous toolbar that I couldn't hide. How do you not have that thing?

code:
(if (boundp 'tool-bar-mode)
    (tool-bar-mode -1))
(menu-bar-mode -1)
Will get rid of the tool bar and menu bar. If you're using Aquamacs you may also want:

code:
(tabbar-mode -1)
Which gets rid of its retarded tabs.

Aquamacs wants these settings in ~/Library/Preferences/Aquamacs Emacs/Preferences.el, reqular Emacs in ~/.emacs. When you're editing the file, if you put the cursor just after each expression you can C-x C-e to run the expression.

Catalyst-proof
May 11, 2011

better waste some time with you

etcetera08 posted:

Okay, I figure this thread is as good as any to ask this question, since it's emacs related.

I'm using Aquamacs on OS X 10.5 and I'm trying to set stuff up like this guy for Python + emacs. Most of the stuff worked fine (I think I ran into issues with just ipdb which is probably another question entirely) and I skipped a few of the config steps for now (like I didn't bother installing the python documentation locally). However, I'm not getting IPython to work at all. Whenever I bring up the py-shell it displays the Python 2.5 shell which is the last thing I want. IPython works when I launch it in Terminal and seems to be installed fine to work with Python 3 but for some reason it won't come up in Aquamacs. Both python-mode.el and ipython.el are in my load-path.. I'm not sure what else to try.

Any ideas? Need more info to help?

ipython.el is a clusterfuck of not-working due to the various factors involved:

* the version of Emacs you're running
* the version of ipython you're running
* the version of python-mode you're using
* the version of ipython.el you're using
* whether you're using virtual environments
* whether your PYTHONPATH and PATH are getting applied correctly enough in between Emacs and your OS

Right now, the most recent versions of python-mode.el (6.0+) do *not* work with ipython.el. The older versions (5.2 or so) do work, but break in other ways. You can trick python-mode into running an ipython shell, but it doesn't provide you the completion and other features of ipython.el. In other words, unless you're experienced enough to try fixing some of the issues involved (serious understanding of comint modes) the only thing to do is wait or find a configuration that doesn't piss you off enough. It's kind of disappointing; I'm dealing with the same exact issue myself.

EDIT: The maintainer of python-mode.el is slowly working on getting ipython integrated into it, but it's probably going to be slow going for a while, and of course none of it is documented so there's no way to tell what even works.

EDIT 2: Actually, I take it back. python-mode.el 6.0.3. seems to have a nice ipython integration without ipython.el (just M-x ipython within a python-mode buffer, works for me for Python 2.6.5 and ipython 0.11). Completion doesn't seem to work yet but I'm playing with it now.

FINAL EDIT: Okay, yeah. The python-mode 6.0.3 is your best bet going forward. Looks like a whole bunch of things are going to be fixed in the coming versions, so it's just a matter of patience for the features you need, but I get the sense python-mode is going to become the de facto extension for interacting with Python/Ipython shells.

Catalyst-proof fucked around with this message at 15:32 on Oct 7, 2011

etcetera08
Sep 11, 2008

Thanks for the info. I will definitely keep playing around with 6.0.3 then, as I was using 6.0.2 before.

edit: well that backfired. now I can't get any shell to come up.

etcetera08 fucked around with this message at 17:34 on Oct 7, 2011

Catalyst-proof
May 11, 2011

better waste some time with you
Let me know what version of Emacs, python, python-mode, and ipython you're running, and the results of (getenv "PATH") and (getenv "PYTHONPATH"). If you're receiving an error, evaluate (setq debug-on-error t) and then provide the traceback produced by trying to open a shell. If you've been swapping out libraries live, you may need to restart Emacs. I've found unload-feature doesn't take care of all the crap that python-mode creates (I'm not even sure I'm meant to use unload-feature in that way :()

Zombywuf
Mar 29, 2008

Fren, do you know of any way for compilation mode to understand tracebacks? Having next error jump through every line in the traceback is annoying. Or even better to understand the whole output of unittest (and run tests on a save hook)?

Catalyst-proof
May 11, 2011

better waste some time with you

Zombywuf posted:

Fren, do you know of any way for compilation mode to understand tracebacks? Having next error jump through every line in the traceback is annoying. Or even better to understand the whole output of unittest (and run tests on a save hook)?

Gonna assume you're talking about running Python test suites with M-x compile. For pdb support I seem to be able to just open up a shell (C-x M-m) and run my nosetests test suite at the prompt. When pdb open up it seems to figure out where files are and starts PDB mode. Maybe try that with your unittest test suite?

etcetera08
Sep 11, 2008

Fren posted:

Let me know what version of Emacs, python, python-mode, and ipython you're running, and the results of (getenv "PATH") and (getenv "PYTHONPATH"). If you're receiving an error, evaluate (setq debug-on-error t) and then provide the traceback produced by trying to open a shell. If you've been swapping out libraries live, you may need to restart Emacs. I've found unload-feature doesn't take care of all the crap that python-mode creates (I'm not even sure I'm meant to use unload-feature in that way :()

Emacs: GNU Emacs 23.3.50.1 (Aquamacs on OS X)
python: Attempting to use Python 3.2.1, but also have Python 2.5.1 installed, which is the py-shell that comes up when I'm using python-mode 6.0.2. When I use python-mode 6.0.3 I get an error from (C-c !). ('Symbol's value as variable is void: py-python-command')
python-mode: Described above, tried 6.0.2 and 6.0.3. Restarted Emacs completely when switching out so that shouldn't have been the issue.
IPython: 0.11 with Python 3.

I, um, don't know how to get the results of (getenv "PATH") and (getenv "PYTHONPATH").. :smith:

edit: got some help in IRC.
"PATH": /Library/Frameworks/Python.framework/Versions/3.2/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/texbin
"PYTHONPATH": gives me No Match with 6.0.3 or 6.0.2

etcetera08 fucked around with this message at 23:28 on Oct 7, 2011

Catalyst-proof
May 11, 2011

better waste some time with you
etcetera08, is it possible that the uninstallation/installation of python-mode didn't go properly? python-mode 6.0.2 defines a variable py-python-command, that should be set the executable of the python you want to run, I think. Since it's in python-mode.el, it should have gotten evaluated when python-mode was required. The fact that there wasn't a variable for that means something didn't get loaded correctly. Trying to narrow down my versions of everything to help you more.

Could you post the value of your load-path variable? C-h v load-path RET

Zombywuf
Mar 29, 2008

Fren posted:

Gonna assume you're talking about running Python test suites with M-x compile. For pdb support I seem to be able to just open up a shell (C-x M-m) and run my nosetests test suite at the prompt. When pdb open up it seems to figure out where files are and starts PDB mode. Maybe try that with your unittest test suite?

Well, I'd also like for g++ "in file included from ..." chains to a appear as one error instead of half a dozen. Will give pdb a try for python though.

Catalyst-proof
May 11, 2011

better waste some time with you

Zombywuf posted:

Well, I'd also like for g++ "in file included from ..." chains to a appear as one error instead of half a dozen. Will give pdb a try for python though.

Ahh. Don't write much in C++ anymore so I haven't gone searching for anything like that. Sorry :(

comedyblissoption
Mar 15, 2006

It seems emacs really needs packages (or bundled modules) for specific language environments. I'm thinking of packages like http://common-lisp.net/project/lispbox/. There's a lot to be said for just having stuff work 'out of the box' instead of having to search down all the relevant basic modules and executables (that could be packaged) you need to make developing code in whatever environment easier and then having to figure out how to get emacs to load those modules and then make configurations that most users would want.

Catalyst-proof
May 11, 2011

better waste some time with you

comedyblissoption posted:

It seems emacs really needs packages (or bundled modules) for specific language environments. I'm thinking of packages like http://common-lisp.net/project/lispbox/. There's a lot to be said for just having stuff work 'out of the box' instead of having to search down all the relevant basic modules and executables (that could be packaged) you need to make developing code in whatever environment easier and then having to figure out how to get emacs to load those modules and then make configurations that most users would want.

I mean, the package stuff in Emacs 24 is completely rudimentary because they don't know what direction to take it in yet, but people are already using it for just the thing you describe. The Emacs Starter Kit I lambasted in one of the OPs has actually switched to providing all its useful modules and configurations into plain old packages that are essentially metapackages for the settings and snippets they feel are useful. I could see Emacs distribution servers, each one containing all the packages, settings, and useful functions for doing some particular thing in Emacs (The starter kit, for example, is focused on Ruby and Javascript).

equation groupie
Feb 7, 2004

debased and dread pilled
Oh cool, an Emacs thread.

I don't have any real Emacs tips to offer, but if you use Mac OS X you are probably aware that some of the simple control-prefixed key combinations work - like C-a and C-e and C-f and such. If you miss the meta-prefixed key combinations (in my case, particularly M-v and M-f), you're in luck - you can enable them by editing ~/Library/KeyBindings/DefaultKeyBinding.dict to look like this:

code:
/* ~/Library/KeyBindings/DefaultKeyBinding.dict */

{
	"^ " = "setMark:";
	"^a" = "moveToBeginningOfLine:";
	"^e" = "moveToEndOfLine:";
	"^j" = "setMark:";
	"^v" = "pageDown:";
	"^w" = "deleteToMark:";
	"^x" = {
		"^m" = "selectToMark:";
		"^x" = "swapWithMark:";
    };
	"~" = "deleteWordBackward:"; /* Note: this is C-q backspace in Emacs */
	"~^h" = "deleteWordBackward:";
	"~b" = "moveWordBackward:";
	"~d" = "deleteWordForward:";
	"~f" = "moveWordForward:";
	"~n" = "scrollLineDown:";
	"~p" = "scrollLineUp:";
	"~v" = "pageUp:";
    "@\U007F" = "deleteWordBackward:"; /* cmd-backspace */ 
}
You can define your own using things you see here and examples on the Web. A "^" character denotes control, "~" denotes option, and "@" denotes command.

(Trivia: There are actually two formats for this file, the old-style NeXT formatting, like you see above, and the new-style XML, which is probably the default on your system or you can see an example here. I had converted my file to the new style (or maybe a Mac OS X upgrade did it for me, I don't remember), but then recently I realized that I hit cmd-backspace expecting it to deleteWordBackward (which I believe opt-backspace does by default), but instead it is deleteLineBackward or something else. However, I couldn't get it to work - because, as it turns out, the @\U007F entry for cmd-backspace won't work at all in an XML DefaultKeyBinding.dict.)

Addendum: If you're new to Emacs and you keep hearing about how it's got an email client and a web browser, some caution. Those things won't replace Safari and Mail (or whatever you use) for anything approaching "normal use". If youre curmudeony enough to be able to stomach using Emacs as your MUA, you're probably already doing it. Even jwz doesn't read his email in Emacs anymore. If you're aware of all this and want to experiment, then do so by all means... just don't expect GNUS to be a drop-in Gmail replacement. Like. At all.

OTOH if you're way beyond this and just can't get enough Emacs, I recommend checking out conkeror. It's a browser based on Mozilla XULRunner, which means you get fancy new features like JAVASCRIPT and even BROWSER PLUGINS (unlike emacs-w3m), in a mostly Emacs friendly way. I've tried it several times and I think it's just not for me, but it's at least a step in the right direction. (Unlike, IMO, emacs-w3m.) You might also be interested in stumpwm, which is an X11 window manager written in Lisp in an Emacsy way with an Emacsy UI. When I tried it last, it was pretty nice, but I don't run Linux on the desktop any more so I never use it.

Comedy option: Don't do any of that but instead use SXEmacs. In addition to being a mail and IRC client, SXEmacs can also be your X11 window manager and login shell! (Though apparently not at the same time; "We wouldn't recommend trying to run an X session from it" as your shell.) Terrifying.


Fake edit: also, I have had caps lock mapped to control for years and I have some serious Emacs pinky right now (for the first time in my life). It loving sucks.

Real edit: some binaries links for the OP, if you want them:

On Windows, I used to get them from here. These binaries work, but they're old. They are the only ones to come with a workable installer. If you're brand new, you should probably start here... just click the "Download latest EmacsW32+Emacs patched" button from the download page. If you want Emacs24, you'll have to get it without the installer (which does stuff like register file associations and such) from the official alpha builds distribution point.

On Mac OS X the situation is all so much simpler. You can get some good pre-built packages from https://emacsformacosx.com, including pretest releases such as for Emacs24 from the builds page. (The brew install method may also work very well, I've just never used it for Emacs.)

equation groupie fucked around with this message at 20:45 on Oct 10, 2011

comedyblissoption
Mar 15, 2006

Why don't more people hit left ctrl with where their knuckle meets the palm rather than the pinky? People seem to go through a lot of hoops on windows to rebind ctrl to caps.

Zombywuf
Mar 29, 2008

comedyblissoption posted:

Why don't more people hit left ctrl with where their knuckle meets the palm rather than the pinky? People seem to go through a lot of hoops on windows to rebind ctrl to caps.

I can only assume your keyboard is a really weird shape. Even the mac has the option to remap your capslock in the keyboard preferences these days. Also emacs keybindings seem to work in most text entries, makes me wonder if Steve was a secret Emacs user.

Catalyst-proof
May 11, 2011

better waste some time with you

vlack posted:

:words:

Thanks, vlack! Updating the OP now.

h_double
Jul 27, 2001

Zombywuf posted:

I can only assume your keyboard is a really weird shape. Even the mac has the option to remap your capslock in the keyboard preferences these days. Also emacs keybindings seem to work in most text entries, makes me wonder if Steve was a secret Emacs user.

Those keybindings are pretty universal in Unix-type operating systems (they work in bash too), and OSX is basically BSD Unix under the hood.

Catalyst-proof
May 11, 2011

better waste some time with you
Does anyone use a mixed mode for HTML and inline Javascript that's not a complete pain in the rear end to use and work with (i.e., nxhtml?)

TasteMyHouse
Dec 21, 2006

h_double posted:

Those keybindings are pretty universal in Unix-type operating systems (they work in bash too), and OSX is basically BSD Unix under the hood.

A little off topic, and you might already know this, but you can configure bash to work in Vi mode with $ set -o vi -- you can change it back with $ set -o emacs, so the keybindings are definitely emacs inspired, at least in the case of bash.

evensevenone
May 12, 2001
Glass is a solid.
I don't know if this belongs in the latex thread or here, but has anyone gotten preview-mode to work? I've tried it on both ubuntu (using texlive and whatever emacs comes with ubuntu) and on OSX using aquamacs and mactex and in both cases I can't get the preview images to show up. The PS file gets generated but there's always some error in the postscript and ghostscipt can't make images out it.

Also, has anyone gotten whizzy-mode to work on an OSX emacs? what emacs and what tex distribution did you use?

floWenoL
Oct 23, 2002

evensevenone posted:

I don't know if this belongs in the latex thread or here, but has anyone gotten preview-mode to work? I've tried it on both ubuntu (using texlive and whatever emacs comes with ubuntu) and on OSX using aquamacs and mactex and in both cases I can't get the preview images to show up. The PS file gets generated but there's always some error in the postscript and ghostscipt can't make images out it.

Are you on OSX pre-Lion? If so, you'll need to do this:

sudo sed -i -e 's/copy_trailer_attrs/process_trailer_attrs/g' /usr/local/share/ghostscript/8.71/lib/pdf2dsc.ps

(Backup that file first if you want to be safe.)

orphean
Apr 27, 2007

beep boop bitches
my monads are fully functional

Fren posted:

I mean, the package stuff in Emacs 24 is completely rudimentary because they don't know what direction to take it in yet

If they added in upgrading already installed packages it would be more or less there for basic use. Ideally I'd like to see them provide more of a QuickLisp interface for the packages. Nothing stopping me from writing one I guess (except laziness)

Fren posted:

The Emacs Starter Kit I lambasted in one of the OPs has actually switched...

This just made it from completely horrid to mostly terrible. Other than a few things (like Yegge's effective emacs tips) I really think most people would best served by learning Emacs as is and making configuration changes organically. I admit I'm probably just being geezerish but I'm from the school of 'You should know what the hell that poo poo in your .emacs does'.

Fren posted:

Does anyone use a mixed mode for HTML and inline Javascript that's not a complete pain in the rear end to use and work with (i.e., nxhtml?)

I'm glad I'm not the only one who doesn't care for nxHtml. I have some mental block when trying to use that drat thing. For just multiple mode support without alot of the extra cruft check out MultiWebMode (https://github.com/fgallina/multi-web-mode) Basically to use it you just setup a plist where the label is the name of the mode you want to use and the value is a regex telling it how to recognize the region for that mode. This is all documented. As a plus you can use whatever major-mode you want for each thing easily. Want js2-mode for javascript? Go for it. Want some funky custom mode for css? Sure, why not. Etc.


For an actual contribution to the thread I present for the thread's pleasure: Common Lisp in Emacs.



For the 2 of you (am I being generous? Probably) who give a crap about Lisps (or Schemes, what have you) you will find no better environment than Emacs + SLIME. In that screenshot I'm also using AutoCompleteMode with the AC-Slime backend for the code completion stuff. And if you like your parentheses to look like fruity pebbles may I point you to rainbow-delimiters.

Incidentally, AutoCompleteMode has a Semantic (part of CEDET) powered backend that does a good job offering code completion for C/C++ and a great deal else. There's also GCCSense which involves you compiling a customized GCC compiler of all things. That's a bit more hardcore.

There's other options for completion but most of them involve crap like completions showing up in a separate buffer or in a tooltip or some such nonsense. Autocomplete works the way I want it to work (and as a bonus works without X).

Good thread, I'd much rather talk about Emacs with goons than random EmacsWiki weirdos.

orphean fucked around with this message at 04:02 on Oct 23, 2011

pgroce
Oct 24, 2002

PlesantDilemma posted:

So whats a good way to sync up my configuration across various computers? I've got a windows laptop that I use emacs on, a school account that I ssh into, and another class is suppose to set me up with another ssh account whenever the professor gets his act together. I'm not the most experienced guy on the command line so I was thinking of putting a config that I like on a webserver and have a little script wget it and move it to the proper place for .emacs to be. Maybe you experts know of something better?

Another approach to this would be to edit remote files in your local Emacs using Tramp. I still log into remote hosts sometimes to edit files sometimes, but I find it's so seldom that I don't need my full-blown Emacs environment.

(And when I do, I usually use vi. :ssh:)

Tramp is awesome -- just read the manual. I really like the rest of emacs, but even if I hated it, I'd have to hate it a LOT to leave Tramp behind.

orphean
Apr 27, 2007

beep boop bitches
my monads are fully functional

pgroce posted:

Tramp is awesome -- just read the manual. I really like the rest of emacs, but even if I hated it, I'd have to hate it a LOT to leave Tramp behind.

Pretty much this. Tramp is super powerful and can do a lot of stuff that might not be obvious at first glance.

One of the things I use Tramp for all the time is opening read-only files. So normally you'd need to hop into a terminal, use sudo, open the config file, edit, save, etc. With Tramp you can do this without leaving emacs and without running an emacs with elevated privileges.

Let's say we want to edit our /etc/hosts file. In Emacs we use C-x C-f to open a file as normal. But instead of just opening /etc/hosts (which will be read only since we're not retarded and don't run as root) we pass in the following for the file name:
code:
/sudo::/etc/hosts
This will use tramp to open the file. It will prompt you for your password and boom, you can edit and save /etc/hosts in emacs. The double colons tell tramp to use the default user/host string (root@localhost) which will pretty much work fine but if you needed different credentials put the user@host between them.

Beef
Jul 26, 2004
Another hint if you're using emacs for any s-expr language like Common Lisp, Scheme or Clojure:

ParEdit and Redshank modes constraint you to only s-expr, it becomes impossible to write unbalanced parenthesis and so on. You will have to get used to new commands such as joining and splitting expressions, but it significantly speeds up your Lisp coding. Check out the screencast on the Redshank link for an example.

Catalyst-proof
May 11, 2011

better waste some time with you

orphean posted:

:words:

Sup, SBCL+Emacs+Slime buddy! Writing Lisp in Emacs is such an unbelievable pleasure, and the functionality so immensely powerful, that using any other tool for any other language feels completely primitive. It's kind of sad. I use rainbow-delimiters, but Paredit still throws me off often enough that I can't really work in it yet. But I do have the Hyperspec linked up through Info-mode, as well as being able to lookup the current word in the Hyperspec instantly. Still trying to work on the holy grail, that is: having one version of slime and swank that works with SBCL locally, SBCL remotely, and Clojure. And thanks for the tip on multi-web-mode! Looks exactly like what I was looking for.

I agree on the geezerism of building your Emacs from scratch. Like I said in the OP, working with Emacs is like building your own lightsaber.

Finally,

orphean posted:

I'd much rather talk about Emacs with goons than random EmacsWiki weirdos.

[img-xah-lee]

orphean
Apr 27, 2007

beep boop bitches
my monads are fully functional

Fren posted:

Sup, SBCL+Emacs+Slime buddy!
:frogc00l::respek::chord:

I can't get into ParEdit either. The electric parens and stuff just skeev me out. I keep trying every now and then hoping something will click.

Also, good luck on your honorable quest. I've gotten connecting to a remote lisp image figured out but honestly that whole chunk of SLIME is basically represented in my mental map with an elaborate 'Here be dragons' sign.

Fren posted:

[img-xah-lee]

When i look at computer keyboards, saliva drools from the corner of my mouth.

You know how girls do window-shopping as a life-long regular activity? and some guys do window-shopping of cars? I don't need another keyboard, i already have plenty. But, i look at them, look for them, stare at them for hours, every week.

orphean fucked around with this message at 17:38 on Oct 24, 2011

Beef
Jul 26, 2004
You could always use pedals, like an emacs loving grandmaster:

http://www.cb1.com/~john/computing/emacs/handsfree/pedals.html

Zombywuf
Mar 29, 2008

orphean posted:

You know how girls do window-shopping as a life-long regular activity? and some guys do window-shopping of cars? I don't need another keyboard, i already have plenty. But, i look at them, look for them, stare at them for hours, every week.

But, if you have a Kinesis all other keyboards become like empty husks of typing misery.

shrughes
Oct 11, 2008

(call/cc call/cc)

Zombywuf posted:

But, if you have a Kinesis all other keyboards become like empty husks of typing misery.

I see you and raise you to Topre keyswitches.

Zombywuf
Mar 29, 2008

shrughes posted:

I see you and raise you to Topre keyswitches.



Make the layout less cruel to fingers and I'll think about it.

Adbot
ADBOT LOVES YOU

equation groupie
Feb 7, 2004

debased and dread pilled

Zombywuf posted:

Make the layout less cruel to fingers and I'll think about it.

Seriously. I love the idea of mechanical key switches. They feel neat.

Not as neat as typing without pain, though.

  • Locked thread