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
Notorious b.s.d.
Jan 25, 2003

by Reene

Zombywuf posted:

Why are you using fixed pixel sized fonts in the year of our lord two thousand and thirteen?

Because they are much sharper than anti-aliased fonts.

Microsoft agrees with me. On Windows, most of the pack-in fonts have bitmap versions for 6-9 pt sizes.

Adbot
ADBOT LOVES YOU

Lothas
Aug 24, 2012
Does anyone use the CEDET pack for Emacs? On the website it describes CEDET as working like an IDE when writing C/C++, I'm curious to know if it can be set up so program's can be compiled and run from within Emacs or if you will still have to run program's from the terminal and weather or not CEDET comes with auto-complete functionality or if I need to get that separately?

h_double
Jul 27, 2001
I haven't used CEDET, but it reportedly does offer intellisense-style completion.

Compiling and running from within emacs is always possible, you don't need CEDET or anything special. You can do something as simple as 'M-x compile', or something a little more sophisticated.

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man

h_double posted:

I haven't used CEDET, but it reportedly does offer intellisense-style completion.

Compiling and running from within emacs is always possible, you don't need CEDET or anything special. You can do something as simple as 'M-x compile', or something a little more sophisticated.

Also, there are magical comments you can put at the head of any file to define the compile-command for that file. And of course since M-x compile executes compile-command, you can write hooks to put in your .emacs that set it.

Zombywuf
Mar 29, 2008

Notorious b.s.d. posted:

Because they are much sharper than anti-aliased fonts.

Microsoft agrees with me. On Windows, most of the pack-in fonts have bitmap versions for 6-9 pt sizes.

Specified in points as not the same thing as anti-aliased.

Notorious b.s.d.
Jan 25, 2003

by Reene

Zombywuf posted:

Specified in points as not the same thing as anti-aliased.

They're specified in pixels because they are non-scalable fonts. They only come in one size, delimited by pixels. The pixel sizes are the literal name of the font, just like "Courier" is named "Courier." I prefer old fashioned bitmap fonts because there is no scaling, aliasing, or anti-aliasing involved.

Does that satisfy your pedantic craving for precision?

Zombywuf
Mar 29, 2008

Notorious b.s.d. posted:

They're specified in pixels because they are non-scalable fonts. They only come in one size, delimited by pixels. The pixel sizes are the literal name of the font, just like "Courier" is named "Courier." I prefer old fashioned bitmap fonts because there is no scaling, aliasing, or anti-aliasing involved.

Does that satisfy your pedantic craving for precision?

Well no, because my font rendering libraries do that for me so I specify everything in points like god intended.

h_double
Jul 27, 2001
Hopefully simple question here. I'm starting to learn R (the statistics language) and naturally my first stop is to look for Emacs support, which comes in the form of the ESS (Emacs Speaks Statistics) package. The package works great except for one thing, I would like to be able to scroll back through my command history in the R console. Running R directly from the command line does this (same way as using up arrow to scroll back through command history in bash), but up arrow in ESS moves the cursor up and down lines around the buffer.

I found this article with a good intro and some customizations, including this code snippet:

code:
(add-hook 'inferior-ess-mode-hook
    '(lambda nil
          (define-key inferior-ess-mode-map [\C-up]
              'comint-previous-matching-input-from-input)
          (define-key inferior-ess-mode-map [\C-down]
              'comint-next-matching-input-from-input)
          (define-key inferior-ess-mode-map [\C-x \t]
              'comint-dynamic-complete-filename)
     )
 )
which I stuck in my .emacs, eval'd, but it doesn't seem have any effect. C-up and C-down don't do anything and emacs tells me "C-x t is undefined" in the ESS/R buffer.

Am I missing something simple/stupid?

aerique
Jul 16, 2008

h_double posted:

The package works great except for one thing, I would like to be able to scroll back through my command history in the R console.
...
Am I missing something simple/stupid?
Have you tried M-p and M-n? It might be because I haven't had my morning coffee yet but AFAIK those keys are the defaults for moving back and forward through history for a lot of modes.

You can also do "C-h m" (describe-mode) to see what keys are bound for the mode, maybe it's listed there.

SYSV Fanfic
Sep 9, 2003

by Pragmatica
I am having trouble getting emacs-for-python up and running. I used apt-get to install the dependencies, I am following the workflows on youtube, but I can't get flymake working. Everything else works, autocomplete etc. Anyone have any tips?

Opinion Haver
Apr 9, 2007

If I have some 'template' that looks like

code:
void foo_X(int Y);
and I want to insert this multiple times with different values for X and Y, what's the easiest way to do that?

aerique
Jul 16, 2008

Opinion Haver posted:

If I have some 'template' that looks like

code:
void foo_X(int Y);
and I want to insert this multiple times with different values for X and Y, what's the easiest way to do that?

I'm not sure it is the easiest but YASnippet is a nice templating library that will be able to do this.

http://ergoemacs.org/emacs/yasnippet_templates_howto.html

Here's an example I made for xsl:choose:

code:
#name : xsl:choose
# --
<xsl:choose>
  <xsl:when test="$1">
    $0
  </xsl:when>
  <xsl:otherwise>
    $2
  </xsl:otherwise>
</xsl:choose>
Your template would look something like this (untested):

code:
#name : void_foo
#--
void foo_$1(int $0);
IIRC, $0 is where you want the cursor to end up once the template is inserted. $n (n>1) are fields you can step through with TAB before ending up at $0.

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Opinion Haver posted:

If I have some 'template' that looks like

code:
void foo_X(int Y);
and I want to insert this multiple times with different values for X and Y, what's the easiest way to do that?
- Type each pair on consecutive lines separated by a space
- select the list
- M-x narrow-to-region
- M-x replace-regexp <enter> \(.*\) \(.*\) <enter> void foo_\1(int \2);
- M-x widen

Gazpacho fucked around with this message at 10:39 on Nov 26, 2013

Pham Nuwen
Oct 30, 2010



For anyone interested in doing email with Emacs, I found Notmuch (http://notmuchmail.org/) has a really great Emacs mode. I used it to read my work email for about 2 years before I finally had to change to Exchange (only way to get a corporate blackberry).

The best part is the fast, Gmail-like searching. It also handles threading well and can display images inline. Good keybindings too.

Do any of you use twittering-mode? I set it up today and it's pretty convenient for stealthily reading Twitter during meetings, but I haven't figured out how to view replies to another user's tweet. Anyone?

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

Catalyst-proof
May 11, 2011

better waste some time with you
Has anyone extensively hosed with customize?

I like that it exists, and that most modes create groups in it, but I can't stand the single-settings-file restriction. I run Emacs on different OSes, for different purposes, and what I've found is I need:

- A 'global' file for settings I want across all computers
- Per-OS settings
- Per-machine settings

So that whenever I make a modification in Emacs' Customize UI, instead of just automatically making the change to my custom-file, I could pass arguments to save the changes to one of the above settings files. Is this even remotely possible?

Hollow Talk
Feb 2, 2014

PlesantDilemma posted:

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

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

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...

Hollow Talk
Feb 2, 2014

PlesantDilemma posted:

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

Glad I could help! For what it's worth, I've been running 8.x for quite a while without any problems, and I'm using it heavily. If you want to upgrade, you can find out about changes that break backwards compatibility (one of which is the html_head thing) here: http://orgmode.org/worg/org-8.0.html

The normal ELPA gnu repository (via list-packages) has an updated version from yesterday, which, I presume, is simply a git snapshot.

baby puzzle
Jun 3, 2011

I'll Sequence your Storm.
I am still using emacs because I haven't found a replacement for orgmode yet.. I wonder if I should completely start again, though.

Is there a package that makes emacs behave like a decent modern program? I still have all of these problems:

- I am still manually resizing the window every time I open it.
- I am still manually opening all of my files because emacs doesn't remember which files I had open.

Those issues are really just the tip of the iceberg. Any modern program just does those things automatically because it isn't 1983.

Edit: I found ErgoEmacs after posting. I think I'll try it out.

Edit 2: Nevermind, that thing sucks.

baby puzzle fucked around with this message at 01:10 on Feb 22, 2014

Pham Nuwen
Oct 30, 2010



^^^ oh god Xah Lee :(

Anyway, I just spent a lovely time trying to make emacs insert a goddamn tab character when I'm writing C code and insert 4 spaces when I'm doing C++. At one point, it decided that I must want each indent to consist of a single tab and a single space. Then for a while it gave me two spaces. Now it finally seems ok, except my teammates have decided to name their C++ header files "whatever.h", which means emacs thinks it's doing C.

Have you ever noticed how hard it is to make Emacs put in a real honest to god tab character into a file? It really likes to put in some number of spaces, chosen seemingly at random because that's how RMS indented his poo poo on ITS in 1969.

Deus Rex
Mar 5, 2005

baby puzzle posted:

I am still using emacs because I haven't found a replacement for orgmode yet.. I wonder if I should completely start again, though.

Is there a package that makes emacs behave like a decent modern program? I still have all of these problems:

- I am still manually resizing the window every time I open it.
- I am still manually opening all of my files because emacs doesn't remember which files I had open.

Those issues are really just the tip of the iceberg. Any modern program just does those things automatically because it isn't 1983.

Edit: I found ErgoEmacs after posting. I think I'll try it out.

Edit 2: Nevermind, that thing sucks.

You can set a default frame size by customizing default-frame-alist. Good SO answer here: http://stackoverflow.com/a/94277/692055

As for remembering open files, I personally keep an emacs process running all the time with a server, and connect to it with emacsclient if I need to open something from the command line. Emacs also ships with desktop-save-mode which persists a list of open buffers when you close Emacs.

You could also look at something like projectile for switching to a 'project', opening files/buffers from that project, and closing all their buffers all very quickly.

Pham Nuwen posted:

Have you ever noticed how hard it is to make Emacs put in a real honest to god tab character into a file? It really likes to put in some number of spaces, chosen seemingly at random because that's how RMS indented his poo poo on ITS in 1969.

C-q <Tab>? Or do you want to switch to hard tabs for indentation everywhere?

shrughes
Oct 11, 2008

(call/cc call/cc)
I thought it inserted tab characters, not spaces, by default.

Deus Rex
Mar 5, 2005

Yeah actually that sounds right. If you want to just disable auto-indentation on <Tab> then you can disable indent-tabs-mode.

Pham Nuwen
Oct 30, 2010



shrughes posted:

I thought it inserted tab characters, not spaces, by default.

I'll have to check... I've been loving with my .emacs on and off for years now, so it would be interesting to see what happens when I disable related to indentation.

shrughes
Oct 11, 2008

(call/cc call/cc)
I mean it'll still magically indent C and C++ by default, with two space indentation or 2+2=4 GNU indentation. But when it gets up to 8 or more spaces you start getting tabs instead of spaces. It doesn't just indent code with a tab character per indentation level or anything sane.

Pham Nuwen
Oct 30, 2010



shrughes posted:

I mean it'll still magically indent C and C++ by default, with two space indentation or 2+2=4 GNU indentation. But when it gets up to 8 or more spaces you start getting tabs instead of spaces. It doesn't just indent code with a tab character per indentation level or anything sane.

Yeah I remember that it likes giving you some combination of tabs and spaces and loving hell guys, when I hit Tab it's because I want to increase the indent level by one... So why not insert a tab character and be done with it.

shrughes
Oct 11, 2008

(call/cc call/cc)
Edit: Okay so anyway a real comment, perhaps.

Make the header files named with .hpp instead of .h.

Or: put those little file-mode things in the header in a comment.

Or: make emacs look for a foo.c and foo.cpp file when opening a .h to figure out what kind it is.

Or: make emacs search for "class" or other C++ keywords or C++ headers. I don't know.

shrughes fucked around with this message at 05:09 on Feb 22, 2014

Hollow Talk
Feb 2, 2014

Deus Rex posted:

As for remembering open files, I personally keep an emacs process running all the time with a server, and connect to it with emacsclient if I need to open something from the command line. Emacs also ships with desktop-save-mode which persists a list of open buffers when you close Emacs.

Daemon mode is a godsend anyway because it also allows you to connect either the normal GUI client or the console client, depending on what you need in any given situation. I have the following set in my .bashrc/.zshrc (though it's part of an if-clause there):

code:
export EDITOR='emacsclient -c -a ""'
export VISUAL='emacsclient -c -a ""'
What this means is: -c creates a new emacs frame while -a "" sets the alternative editor to an empty string, which means a new emacs --daemon is started if it was not running before, instead of emacsclient simply not starting. I have them aliased to shorter commands, like so:

code:
alias em="$EDITOR -t"
alias emc=$VISUAL
The -t in the em-alias starts the console interface, the other one uses the normal GUI.

baby puzzle
Jun 3, 2011

I'll Sequence your Storm.

Deus Rex posted:

You can set a default frame size by customizing default-frame-alist. Good SO answer here: http://stackoverflow.com/a/94277/692055

As for remembering open files, I personally keep an emacs process running all the time with a server, and connect to it with emacsclient if I need to open something from the command line. Emacs also ships with desktop-save-mode which persists a list of open buffers when you close Emacs.

You could also look at something like projectile for switching to a 'project', opening files/buffers from that project, and closing all their buffers all very quickly.

I suppose I could spend time doing these things and maybe even have success but I wonder when emacs is supposed to start working for me instead of the other way around...

Anyway, does emacs have something like Sublime Text's command palette? I am simply trying to search for a command. Actually I'm trying to figure out how to sort my todo list in org mode... but I don't see why this simple task should require a google search. Also all references that I can find only give me the shortcut key which I will never remember. I want the actual command name.

weird
Jun 4, 2012

by zen death robot
Sounds like apropos would help? If you know the chord for a command, you can get the function name and documentation with C-h k.

Deus Rex
Mar 5, 2005

Turn on ido-mode and install smex.

Hollow Talk
Feb 2, 2014

Deus Rex posted:

Turn on ido-mode and install smex.



Ever since somebody first pointed out ido-mode to me, this has been one of the things that improved my life the most ever since I started using Emacs. The latter makes searching for and executing commands much easier (and gives a nice history of past commands, which is rather handy when you use the same things repeatedly), while the former makes looking for and opening files just so much better and intuitive.

For ido-mode, I use:
code:
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(ido-mode 1)
And for SMEX:
code:
(eval-after-load "smex-autoloads"
  '(progn
     (global-set-key (kbd "M-x") 'smex)
     (global-set-key (kbd "M-X") 'smex-major-mode-commands)
					; This is your old M-x.
     (global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)
     (setq smex-save-file "~/.emacs.d/.smex.last")))

Deus Rex
Mar 5, 2005

You can also read the org mode manual on the web, or inside Emacs (which I recommend) with C-h i to enter Info, the documentation browser, then m to prompt for a menu item, and type "org<RET>" to choose the "Org Mode" heading. The answer to your question (sorting org items, including TODOs) is in there.

Info is a nice way to read about Emacs and a few packages provide documentation in there.

Notorious b.s.d.
Jan 25, 2003

by Reene

Deus Rex posted:

Info is a nice way to read about Emacs and a few packages provide documentation in there.

Not coincidentally, emacs is about the only non-painful way to browse info pages. All GNU commands have great info manuals and terrible man pages, so getting familiar with emacs for info browsing is valuable to any regular Linux user.

Notorious b.s.d.
Jan 25, 2003

by Reene
I recently learned about projectile-mode and it is really great.

It's yet-another-project mode, but instead of having project config files and all that trash, it just treats every git/hg/svn repository as a project. All the project-related commands Just Work.

Best command: C-c p f, instantly open any file in the project.

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man
My emacs (24) just chokes on large python files, in stock python-mode. Doing something that requires reparsing the syntax highlighting for much of the file will make emacs non-responsive for sometimes upwards of a minute, or indefinitely so I get to kill -9 it. It also takes forever to open these files. Googling around has only given me answers relating to alternate python-modes or which-func mode, all in now-defunct bugzilla reports, which is... not helpful.

Any of you seen anything similar?

Deus Rex
Mar 5, 2005

If you're writing a lot of Emacs Lisp this package is a godsend. SLIME-style M-. and M-, to jump to a symbol's definition and back out again, and a unified shortcut for getting documentation for symbol at point.

https://github.com/purcell/elisp-slime-nav

baby puzzle
Jun 3, 2011

I'll Sequence your Storm.

Zombywuf posted:

Well if you're talking about within emacs you have access to your clipboard history, C-y will paste the clipboard contents, M-y will replace that with the previous contents. Repeated M-y will cycle through the history.

Ok but my windows clipboard is still wiped out. I don't even want that functionality.. I just want ctrl-backspace to delete a word.

Adbot
ADBOT LOVES YOU

wither
Jun 23, 2004

I have a turn both for observation and for deduction.

baby puzzle posted:

Ok but my windows clipboard is still wiped out. I don't even want that functionality.. I just want ctrl-backspace to delete a word.

code:
(defun delete-word-no-kill-ring (arg)
  (interactive "p")
  (delete-region (point) (progn (backward-word arg) (point))))
Bind this to C-backspace.

  • Locked thread