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
PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
emacs is pretty drat awesome. I tried to learn vim but I kept getting confused about what mode I was in. The extensibility of emacs is inspiring. You can customize it to do anything.

I'm very much a emacs newbie, so I'll have plenty of questions for this thread. My first one is about using the shell in emacs. I've been using eshell over the normal M-x shell because it remembers past commands, but eshell doesn't support aliases. Is there a way to do that in eshell or is there a better shell I can use within emacs?

Also, it seems I can only have one instance of eshell running at a time, is there a way around that? On my school accounts I can't use screen, ortherwise I'd use that for all my cool multitasking stuff.

Adbot
ADBOT LOVES YOU

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
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?

Also, for other people new to emacs, I've watched a few of the videos by rpdillon on youtube, he has several screencasts with some nice explanations. This one about setting up multiple little windows convinced me that emacs is powerful enough to spend the time to learn instead of sitting around in nano all day.

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
What's the deal with org mode HTML export? I added a
code:
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="http://mysite.com/org-style.css">
block to my .org file, but when I export it I don't see any <link> tag in the head. The basic CSS that it generates is not great and I want to replace it.

Edit:
I'm running Emacs 24, Org 7.9.3f, on Windows 7

PleasantDilemma fucked around with this message at 20:53 on Dec 12, 2013

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace

Hollow Talk posted:

The HTML_HEAD option has been introduced in Org 8.x, if I am not mistaken. Since you are using the old stable version, you will have to use the older form:

code:
#+STYLE: <link rel="stylesheet" type="text/css" href="stylesheet.css" />
You can find a bit more background here: https://stackoverflow.com/questions/16453427/cant-get-emacs-org-mode-to-use-my-css-file

Yessssss Thanks for this buddy. The org docs don't mention the version requirements. I guess I should look into upgrading...

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
Ok, when pressing page-up or page-down the cursor moves as I scroll through the file. But when I get to the top or bottom of the file, the cursor doesn't go all the way to the top or bottom. It just chills in the middle of the screen. What can I do about this?

Also! holy crap I spent a few minutes and setup multiple cursors mode and now I can use emacs like how I use Sublime Text! :hellyeah: It's actually hard for me to be productive in emacs because I keep getting excited about some package or mode and spend time reading about it instead of working. M-x package-list-packages is really fun to poke around in.

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
Hey thread, Whats your flow to get tabs to work correctly? I'm in the javascript mode that comes with Emacs 24.3.1. I load a file that uses tabs for indent, and tabs are rendered as 8 spaces. When I press the tab key, I get 4 spaces inserted. I know every mode can set it up differently. What are the usual functions/variables that need to be tweaked to get tabs the way you like? My goal is to edit this javascript file and press tab and get a tab character that renders as 4 spaces.

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
Does every major mode have a hook? I added this to my .emacs

Lisp code:
(defun fn-fix-the-tabs ()
  "Try to make tabs work the way I want :)"
 (interactive)
 (setq indent-tabs-mode t) 
 (setq tab-width 4) 
 (setq c-basic-offset 4)
 (setq tab-stop-list (number-sequence 4 200 4))
 (define-key c-mode-map (kbd "TAB") 'self-insert-command))

(add-hook 'php-mode-hook 'fn-fix-the-tabs)
(add-hook 'javascript-mode-hook 'fn-fix-the-tabs)
But when I open a php or javascript file it does not take effect. If I do M-x fn-fix-the-tabs then it kicks in. Also, do I need (interactive) in there?

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace

Pham Nuwen posted:

it looks like the javascript mode is js-mode, so try (add-hook 'js-mode-hook 'fn-fix-the-tabs)

This did it for my Js stuff, and the php-mode-hook does work, I didn't realize that it wasn't enabling php-mode when I open a php file, it was still in fundamental haha. I added this and now I'm golden:

Lisp code:
(add-to-list 'auto-mode-alist '("\\.php\\'" . php-mode))
Emacs is pretty great and this thread is also great :)

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
Ok I broke my emacs and now I'm sad. Emacs 24.3.1 on Ubuntu. I used the package manger to install the Sublime Text package, now when I start emacs I get some startup errors. Emacs runs but it doesn't load my .emacs file and I can't use the ESC button. Every time I press ESC to do a M-x the minibuff says "Cannot open load file: /yasnippet" Omg I can't do M-x that's like my main thing.

How do I uninstall the sublime package I installed?

Emacs told me to run emacs --debug-init and It points to yasnippet being where the problem is. Or at least that's where stuff breaks, the real problem could be elsewhere.

I see both a yasnippet and sublime folder under .emacs.d/elpa/ should I delete those folders?

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
Thanks for the tips Aerique. Renaming the two folders was enough to get everything working again. Whew.

Hey, does anyone use keybindings other than M-w and C-w for copy/cut ? I don't like M-w for copy, but I don't know what other keybinding to use. I'm afraid I'll overwrite something useful that I just don't know about yet.

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
So I used M-x upcase-region and got a warning about it often confusing new users. What's the story on that? Is it doing something besides just making all the letters capitol? I was surprised by the warning.

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?

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:

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.

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?

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?

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
How do I read an emacs backtrace? I've got one here and I'm not sure where my error is. I was using Org 7.9.3f and today I upgrade emacs to 24.4.1 and it came with Org 8.2.10. I am trying to export an org file to HTML. It was working fine before, but now it will not export. Is there a way to get some line numbers out of that backtrace? It seems like I have a malformed timestamp or time range in my file, but there are thousands of entries I don't know which one is wrong. I can recalculate my clock tables without issue, it's just export that throws an error.

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
Thanks for the detailed answer! I enabled toggle-debug-on-error, but it just results in the same stacktrace that I posted before, i was expecting something interactive. Is there a different way to enable the debugger? I'm running this on Windows 7, does the debugger even run on windows?

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!

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace

Deus Rex posted:

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.

Well, that worked, I feel pretty silly now. Thanks for the tip! I wonder if this machine has a high resolution/dpi screen and perhaps thats why the scale is different.

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
Why is it that when I scroll around in a buffer, the cursor will stay in the visible area? I'm used to modern GUI editors where the cursor stays fixed while I scroll through a file. Is there a flag or mode to get the behavior I'm used to?

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
Looks like EmacsConf is this weekend in San Francisco. Anyone going? Seems much of it will be live streamed. I plan to check it out, maybe get a emacs guru to show me how helm mode is installed and used.

http://emacsconf2015.org/

Adbot
ADBOT LOVES YOU

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
Lets say I have this org file:

code:
#+COLUMNS: %40ITEM(Task) %17Effort(Estimate){:} %CLOCKSUM

#+BEGIN: clocktable :maxlevel 2 :scope file 
#+CAPTION: Clock summary at [2016-04-07 Thu 17:28]
| Headline     |   Time |
|--------------+--------|
| *Total time* | *3:47* |
|--------------+--------|
| first        |   1:00 |
| second       |   0:21 |
| third        |   2:26 |
#+END:

* first
  CLOCK: [2016-04-07 Thu 1:29]--[2016-04-07 Thu 2:29] =>  1:00
:PROPERTIES: 
:Effort: 1:00
:END:

* second
  CLOCK: [2016-04-07 Thu 3:29]--[2016-04-07 Thu 3:50] =>  0:21
:PROPERTIES: 
:Effort: 2:00
:END:

* third
  CLOCK: [2016-04-07 Thu 12:00]--[2016-04-07 Thu 12:29] =>  0:29
  CLOCK: [2016-04-07 Thu 13:00]--[2016-04-07 Thu 14:57] =>  1:57
:PROPERTIES: 
:Effort: 1:00
:END:
According to the org mode docs, I can add :properties to the clocktable and the table will include the propery. I want to include my Effort property, but I can't seem to get it to work. What is the syntax? I tried :properties Effort and :properties :effort: but they do not work. I see the effort when I go to column mode, but I would like to see the effort VS real clock in a central report.

I'm on 24.5.1 on OS X with org version 8.2.10

  • Locked thread