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
Catalyst-proof
May 11, 2011

better waste some time with you

Neon Noodle posted:

Well they got rid of the Escape key on the new Macbook so gently caress vi, obviously.

Ctrl-[ is a much more convenient shortcut for Esc in vim anyway, since each key is within normal typing distance.

Adbot
ADBOT LOVES YOU

Hollow Talk
Feb 2, 2014

horse mans posted:

Ctrl-[ is a much more convenient shortcut for Esc in vim anyway, since each key is within normal typing distance.

Sure, if you use an American keyboard.

Catalyst-proof
May 11, 2011

better waste some time with you

Hollow Talk posted:

Sure, if you use an American keyboard.

How many people don't use an American keyboard? 30, 40 people tops?

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Neon Noodle posted:

Well they got rid of the Escape key on the new Macbook so gently caress vi, obviously.

yeah it doesn't matter, every serious vim user rebinds escape, ctrl, etc, to better things.

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

MALE SHOEGAZE posted:

yeah it doesn't matter, every serious vim user rebinds escape, ctrl, etc, to better things.

What serious vim users?

Most vim users are just using it because some other techbro on HN said it was the way to really crush code when getting down to the metal with Node.js.

Siguy
Sep 15, 2010

10.0 10.0 10.0 10.0 10.0
Spacemacs' evil-mode defaults escape to pressing f and d at the same time and I've grown to really like it. It seems like it would get in the way, but I've never accidentally triggered it and the ergonomics are much nicer.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

eschaton posted:

What serious vim users?

Most vim users are just using it because some other techbro on HN said it was the way to really crush code when getting down to the metal with Node.js.

Anyone who stops for 10 seconds to think "wow, I press these buttons all the time and they're in terrible spots, maybe I should rebind them."

Or perhaps "wow, this button does not exist anymore, perhaps I should rebind it, oh wow this is even better!"

Hollow Talk
Feb 2, 2014

MALE SHOEGAZE posted:

Anyone who stops for 10 seconds to think "wow, I press these buttons all the time and they're in terrible spots, maybe I should rebind them"

Lots of people probably just rebind CAPSLOCK as their ESC key, which is a lot more convenient.

Of course, serious users use CAPSLOCK as Hyper key for their tiling window manager in order to not clash with their myriad of Emacs keybindings. :v:

mike12345
Jul 14, 2008

"Whether the Earth was created in 7 days, or 7 actual eras, I'm not sure we'll ever be able to answer that. It's one of the great mysteries."





Hollow Talk posted:

Lots of people probably just rebind CAPSLOCK as their ESC key, which is a lot more convenient.

Of course, serious users use CAPSLOCK as Hyper key for their tiling window manager in order to not clash with their myriad of Emacs keybindings. :v:

yeah I'm using a model m for a month now, and this is the first thing I did.

wooger
Apr 16, 2005

YOU RESENT?

horse mans posted:

How many people don't use an American keyboard? 30, 40 people tops?

This is true. I'm in the U.K., but only use USA keyboards.

Plus we're talking about MacBooks, the UK Apple keyboard is a sick joke.

pgroce
Oct 24, 2002

Hollow Talk posted:

Lots of people probably just rebind CAPSLOCK as their ESC key, which is a lot more convenient.

Karabiner has a neat thing where you can use return as control if you press something else before you lift your finger up.

That's clever, but it would be much more useful to me if I could bind it to Hyper. :getin:

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

Siguy posted:

Spacemacs' evil-mode defaults escape to pressing f and d at the same time and I've grown to really like it. It seems like it would get in the way, but I've never accidentally triggered it and the ergonomics are much nicer.

Wait really? I've been using jj pressed less than a half second apart, but this sounds better (rebound to "eu" or "ht" for Dvorak). Know how to rebind it?

Siguy
Sep 15, 2010

10.0 10.0 10.0 10.0 10.0
It looks like spacemacs' author released this functionality as a package: https://github.com/syl20bnr/evil-escape

gay for gacha
Dec 22, 2006

Hey emacs guys. I've been using emacs for a week and I was wondering about some things:

If I'm using the doc viewer to read a pdf from within emacs, is there a way to save it so that the next time I open emacs it opens at the same page I was at?
Is there a way to list all the folders associated with a project while I code? I've been opening up a shell and using a cli file manager just to keep track, but I was hoping there was something a bit more seamless.
While I'm at it, can I make it start with split windows? So one for terminal, one for pdf, one for editing code?
Is there a way to switch buffers between split windows more reliably then M-x ido-mode? Like instead be able to do M-x 1, 2 ,3 to switch around from file to file?

Can I boot into emacs instead of X and still read PDFs? It sounds odd, but what I really like about emacs is that it is so inclusive and I never have to leave it, and I think the next step would be just to start in emacs and use it as a windows manager, but I'm not sure if that's possible.

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man

lemonslol posted:

Hey emacs guys. I've been using emacs for a week and I was wondering about some things:

If I'm using the doc viewer to read a pdf from within emacs, is there a way to save it so that the next time I open emacs it opens at the same page I was at?
Don't know this one sorry.

quote:

Is there a way to list all the folders associated with a project while I code? I've been opening up a shell and using a cli file manager just to keep track, but I was hoping there was something a bit more seamless.

This is a whole genre of packages, generally termed "project managers". The big one is projectile, which lets you create projects based on version control repos or folders or really anything, and then once you're in a project has a lot of utilities for e.g. grepping around within the project, running tags searches, opening files in it, etc. It even integrates well with helm, which it seems like you're already using! I use this every day, and my only problem with it is I haven't quite gotten projectile, helm, and perspective quite all working together yet.

quote:

While I'm at it, can I make it start with split windows? So one for terminal, one for pdf, one for editing code?

At least in projectile, and probably in other project managers, there's a provided hook called
code:
switch-project-action
that you can put some elisp in to do this, I can't help you there because I'm not real good at elisp. Ask on the emacs stack exchange!

quote:

Is there a way to switch buffers between split windows more reliably then M-x ido-mode? Like instead be able to do M-x 1, 2 ,3 to switch around from file to file?
Confused about what you're asking here... You already have your splits set up, but the wrong buffers are in each split, so you want to hop around and change them all?
- If this is happening when you're switching between projects, so you have your | pdf | term | code | setup for project A and want to switch to your | pdf | term | code | setup for project B, this is something that perspective will do - once you get a project open, doing
code:
perspective-switch-project
back to that project will change your window and buffer layout to be the same as you left it when you last were in that project.

quote:

Can I boot into emacs instead of X and still read PDFs? It sounds odd, but what I really like about emacs is that it is so inclusive and I never have to leave it, and I think the next step would be just to start in emacs and use it as a windows manager, but I'm not sure if that's possible.

http://www.howardism.org/Technical/Emacs/new-window-manager.html

VikingofRock
Aug 24, 2008




Hey so I'm trying to set up flycheck with a C++ project, but I can't get it to find boost files and I can't seem to find the answer online. I think I must be missing something obvious.

My .dir-locals.el file is:

Lisp code:
(c++-mode
  (flycheck-clang-include-path (list "/usr/local/include/"))
  (flycheck-gcc-include-path (list "/usr/local/include/"))
  (flycheck-clang-language-standard . "c++14")
  (flycheck-gcc-language-standard . "c++14"))
And my code contains the line:

C++ code:
#include <boost/optional.hpp>
This line gets marked as an error by flycheck, saying "'boost/optional.hpp' file not found (c/c++-clang)".

However, /usr/local/include/boost/optional.hpp definitely exists and this whole thing compiles just fine with clang. So what stupid thing am I doing wrong?

Edit: Welp, I added an extra set of parentheses around the whole thing and it seems to have fixed things. I'm not really sure I understand why that made a difference, so I'm gonna change my question to that.

VikingofRock fucked around with this message at 06:12 on Jan 14, 2017

There Will Be Penalty
May 18, 2002

Makes a great pet!

VikingofRock posted:

Edit: Welp, I added an extra set of parentheses around the whole thing and it seems to have fixed things. I'm not really sure I understand why that made a difference, so I'm gonna change my question to that.

The contents of .dir-locals.el is a list (the top level of parentheses after you fixed your file) that can contain multiple mappings (each mapping being your second level of parentheses, a cons of a mode and an association list). What you had in that file before you fixed it was just one mapping. See a clearer example:

https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html

VikingofRock
Aug 24, 2008




There Will Be Penalty posted:

The contents of .dir-locals.el is a list (the top level of parentheses after you fixed your file) that can contain multiple mappings (each mapping being your second level of parentheses, a cons of a mode and an association list). What you had in that file before you fixed it was just one mapping. See a clearer example:

https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html

Oooh that makes sense. I really need to go through some more lisp tutorials sometime to make this all more intuitive.

gay for gacha
Dec 22, 2006

I need something to clock in. I'm not sure how org-mode works, but from what I read it's not exactly what I'm looking for. I have to bill hourly, and I wanted to bill only the time I spend in emacs, so if I tab over and open firefox to watch porn, I want the timer to stop. However, if I open a browser within emacs, presumably to do work related things, I want that to go into the timer. Does anyone know of anything with that functionality, or how I could hack something to have that functionality ?

DARPA
Apr 24, 2005
We know what happens to people who stay in the middle of the road. They get run over.

lemonslol posted:

I need something to clock in. I'm not sure how org-mode works, but from what I read it's not exactly what I'm looking for. I have to bill hourly, and I wanted to bill only the time I spend in emacs, so if I tab over and open firefox to watch porn, I want the timer to stop. However, if I open a browser within emacs, presumably to do work related things, I want that to go into the timer. Does anyone know of anything with that functionality, or how I could hack something to have that functionality ?

https://www.rescuetime.com/

I think this might be what you want. I haven't used it in a very long time, but from what I remember (and I couldn't even remember the name without googling a bit) it would track time spent in each application you run. So you'd get a report on duration for each application as the top/active window. So your work in emacs would all be totaled together, and a separate timer for Chrome/Firefox and another for Solitare/whatever.


It might even break time spent on each specific website down separately so you know how much time you waste on SA vs work related websites.

Beef
Jul 26, 2004
I used rescuetime to ... rescue my PhD thesis writing. You would be surprised how many unproductive hours you spend online on a given work day.

mike12345
Jul 14, 2008

"Whether the Earth was created in 7 days, or 7 actual eras, I'm not sure we'll ever be able to answer that. It's one of the great mysteries."





Beef posted:

I used rescuetime to ... rescue my PhD thesis writing. You would be surprised how many unproductive hours you spend online on a given work day.

I think it's wrong to see this as "wasted" or "unproductive". I need it to deflate, otherwise my mind would go boom. But depends if you can't control it, or use it to evade work. I guess.

Beef
Jul 26, 2004
I do not mean to say that unproductive hours are wasteful. Deflating works best on stuff that is absolutely unproductive and useless!

What I meant was that after a 9 hours work day, I was really surprised to see how that somehow 6 hours of that were spent on stuff like SA and reddit (and I hate reddit). Waaay beyond attributed break time.
I need to take short breaks and often, but I apparently was spending too long on any break than I subjectively realized.

gay for gacha
Dec 22, 2006

Would that program work if I was ssh'd into a box somewhere else? I haven't figured out yet how to do M-x SSH, or tramp mode yet so I wouldn't be running emacs locally.

Soricidus
Oct 21, 2010
freedom-hating statist shill

lemonslol posted:

Would that program work if I was ssh'd into a box somewhere else? I haven't figured out yet how to do M-x SSH, or tramp mode yet so I wouldn't be running emacs locally.

tramp mode is the easiest thing in the world. you literally just need to do find-file normally and then enter a filename like /user@hostname:/path/to/file and emacs will handle the ssh connection stuff transparently.

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
Would that you could just use //nodename/path/to/file

gay for gacha
Dec 22, 2006

what about if I want to just be on the other box not just open a file?

Soricidus
Oct 21, 2010
freedom-hating statist shill

lemonslol posted:

what about if I want to just be on the other box not just open a file?

Open a directory instead, you get a remote dired buffer and any commands you execute are run on the other end

Nude
Nov 16, 2014

I have no idea what I'm doing.
Hey guys so I wanted to key bind a theme in Emacs, with this code here:
code:
(global-set-key (kbd "C-c a") '(load-theme 'tao-yang))
So (load-theme 'tao-yang) works fine in the lisp evaluation buffer. But I get the "Wrong type of argument: commando" error when trying to make it a key bind, which upon research I take that to mean I have to use the interactive function. But my understanding is the interactive function is used for creating functions that are interactive not for already made functions. So now I'm just confused, is there any way to hotkey a function that requires an interactive parameter by putting the parameter through code not user input?

Also I was wondering if there was a way to make it so when I press a modifier it would come up immediately in the buffer rather than waiting 1 second to see if I hit C-x or something. Been trying to google this for hours but can't seem to get a clear answer. Thanks for any help as usual :).

Hollow Talk
Feb 2, 2014

Nude posted:

Hey guys so I wanted to key bind a theme in Emacs, with this code here:
code:
(global-set-key (kbd "C-c a") '(load-theme 'tao-yang))
So (load-theme 'tao-yang) works fine in the lisp evaluation buffer. But I get the "Wrong type of argument: commando" error when trying to make it a key bind, which upon research I take that to mean I have to use the interactive function. But my understanding is the interactive function is used for creating functions that are interactive not for already made functions. So now I'm just confused, is there any way to hotkey a function that requires an interactive parameter by putting the parameter through code not user input?

Also I was wondering if there was a way to make it so when I press a modifier it would come up immediately in the buffer rather than waiting 1 second to see if I hit C-x or something. Been trying to google this for hours but can't seem to get a clear answer. Thanks for any help as usual :).

Basically, the problem here is that load-theme is defined interactively, as per (interactive-form 'load-theme)

code:
(interactive (list (intern (completing-read "Load custom theme: " ...)) nil nil))
We can further check (commandp 'load-theme), which yields t.

The normal way to execute this would be (command-execute 'load-theme), which calls (call-interactively 'load-theme) internally. However, that means the function call still tries to honour the interactive definition, which means it still tries to get the theme name from the minibuffer, because the command loop looks for that.

GNU Emacs Lisp Reference Manual posted:

The interactive form must be located at top-level in the function body, or in the function symbol’s interactive-form property (see Symbol Properties). It has its effect because the command loop looks for it before calling the function (see Interactive Call). Once the function is called, all its body forms are executed; at this time, if the interactive form occurs within the body, the form simply returns nil without even evaluating its argument.

So if you supply your own call to interactive first, the rest will be run as-is, i.e. in this case without paying attention to its own interactive definition. Since global-set-key doesn't take interactive functions, your version yields an error while (global-set-key (kbd "C-c a") (lambda () (interactive nil) (load-theme 'tao-yang))) works. Since lambda is the function in this case, calling an empty interactive function (both (interactive) and (interactive nil) work) means the rest of your function body gets executed as is, which means this essentially binds (load-theme 'tao-yang) "non-interactively", letting you supply the argument directly by "overriding" its internal interactive function. It's...not great design.

tl;dr: After calling interactive once, all subsequent calls to interactive in the function body get treated as nil.

Nude
Nov 16, 2014

I have no idea what I'm doing.

Hollow Talk posted:

Basically, the problem here is that load-theme is defined interactively, as per (interactive-form 'load-theme)

code:
(interactive (list (intern (completing-read "Load custom theme: " ...)) nil nil))
We can further check (commandp 'load-theme), which yields t.

The normal way to execute this would be (command-execute 'load-theme), which calls (call-interactively 'load-theme) internally. However, that means the function call still tries to honour the interactive definition, which means it still tries to get the theme name from the minibuffer, because the command loop looks for that.


So if you supply your own call to interactive first, the rest will be run as-is, i.e. in this case without paying attention to its own interactive definition. Since global-set-key doesn't take interactive functions, your version yields an error while (global-set-key (kbd "C-c a") (lambda () (interactive nil) (load-theme 'tao-yang))) works. Since lambda is the function in this case, calling an empty interactive function (both (interactive) and (interactive nil) work) means the rest of your function body gets executed as is, which means this essentially binds (load-theme 'tao-yang) "non-interactively", letting you supply the argument directly by "overriding" its internal interactive function. It's...not great design.

tl;dr: After calling interactive once, all subsequent calls to interactive in the function body get treated as nil.

Ah thank you, you saved me from a headache, the problem was I was misunderstanding why (interactive) was being used for the lambda examples. But thanks for clearing it up, also I found out my second question the keyword I was looking for was: Echo Area, with the variable (setq echo-keystrokes .1). Thanks for the help :toot:.

tak
Jan 31, 2003

lol demowned
Grimey Drawer
It wouldn't work even if load-theme wasn't interactive. You can't bind non-interactive functions (you can only call them from other interactive functions), and global-set-key expects the binding arg to be "a keymap, a command, a keyboard macro, a symbol that leads to one of them, or nil."

That lambda would do just fine, as would the symbol of an equivalent interactive named function. I prefer the latter to avoid cluttering up e.g.helm-descbinds or which-key:

code:
(defun load-tao-yang-theme ()
  (interactive)
  (load-theme 'tao-yang))
(global-set-key (kbd "C-c a") 'load-tao-yang-theme)

Beef
Jul 26, 2004
A quick 'thank emacs' to start the week:

# Hi-lock: (("ymm3" (0 (quote hi-blue-b) t)))
# Hi-lock: (("ymm2" (0 (quote hi-green-b) t)))
# Hi-lock: (("ymm1" (0 (quote hi-red-b) t)))
# Hi-lock: (("r9" (0 (quote hi-pink) t)))
# Hi-lock: (("[Vv]movups" (0 (quote hi-black-hb) t)))

Just made trawling through lovely Eigen-emitted assembly several magnitudes more readable, without having to enter the highlight rexexps every time. Being able to dump your file-specific configurations in the file itself is something that I'de wish more editors/IDEs would steal.

Adbot
ADBOT LOVES YOU

shovelbum
Oct 21, 2010

Fun Shoe
I use emacs sometimes, not enough to have any real proficiency with it but I can install stuff and change modes and edit text which I guess is nice, and my big thought on these all-keyboard editors is that I always kind of sneer at them when I am on my thinkpad and have the mouse on the home row, but when I get to my desktop with a standard mouse, it does seem like a hassle. I am just a hobbyist and a newb though so my coding has never in my life been limited by my typing speed so much as my thinking and googling.

  • Locked thread