logs archiveIRC Archive / Freenode / #emacs / 2015 / July / 22 / 1
tali713
blaenk: yeah, sort of, what do you mean by "opened" and "whenever". perhaps just explaining the intended use would be faster.
blaenk
I did explain my intended use. basically when I'm in a projectile-controlled file I want to set a binding to one function, but when I'm not, I want to set it to another thing
the thing is I enable projectile globally so that it auto-detects if a given file is under projectile applicable or not
tali713
okay, so you want it whenever a buffer is first created then.
blaenk
that'll work :D
tali713
or do you mean when a file is first visited?
blaenk
then I will check with projectile's (projectile-project-p) to see if it actually _is_ underp rojectile control and if not then set the binding that I want when it's in projectile
not sure to be honest. I guess when a file is visited first
tali713
do you care about all files or only files that are in programming language modes?
blaenk
all files would be preferable
one approach I was thinking of was setting the key in projectile mode's map, and then adding a projectile mode hook that checked if it ended up being projectile applicable or not and if not then turned off projectile mode for that buffer
tali713
blaenk: okay, `find-file-hook'
         

blaenk
thanks!
tali713
generally it would make more sense to use something like prog-mode-hook. and shouldn't a projectile controlled file have it's own minor mode map associated with projectile?
blaenk
it does, that's what I said I was going to use just now
the problem is that projectile mode enables itself globally (cause I want it to, so it'll automatically see if a given file is projectile-applicable or not)
tali713
so, this is all moot. :)
blaenk
and if it ends up not being applicable, it doesnt turn itself off, it remains on
so _just_ adding it to that map isn't sufficient
benaiah
,xy
fsbot
[->] xyproblem is when you want to do X, and you think Y is how, so you ask about Y instead of X. See <http://www.perlmonks.org/index.pl?node_id=542341> or <http://mywiki.wooledge.org/XyProblem>
blaenk
don't think that's relevant, I did state my question at first lol
tali713
blaenk: I'll have to look at how projectile works.
blaenk
thanks I appreciate it!
I did find in the source (projectile-project-p) which says if projectile does apply ornot
so I was going to do something like this
benaiah
blaenk: that wasn't aimed at you, I was trying to remember the name of that fsbot entry
blaenk
no worries :)
tali713: https://gist.github.com/blaenk/8cfa0fee62a2d507cb6f
actually you know what
I think I couldjust add that check in the binding itself
:D
no need for a hook
tali713
pretty much, problem solved. :)
blaenk
sweet
not sure if there's much use in having projectile enabled when afile is not under projectile control, I guess I'll deal with thatwhen it happens if so
tali713
blaenk: well you could, instead of running projectile globally, run it in e.g. prog-mode-hook conditionally based on projectile-project-p.
blaenk
oh yeah that's a better idea
but I'm still not sure if prog mode is the way to go. I want this to apply to readme.md files for example (markdown) are those prog mode too?
or say README.txt etc
tali713
blaenk: in that case assuming you have (defun blaenk-cond-proj ...) you could add it to prog-mode-hook and also have a (defun filename-run-matching (regexp) (when (and buffer-file-name (string-match regexp buffer-file-name)) (run-hooks find-file-matching-hooks))) the rest is left as an exercise.
err find-file-matching-hook, rather. (naming convention)
Arvid
Anyone using fish shell in ansi-term? I seem to get some really strange input when I retype something I have written previously for example the second time I type 'echo hello world' it comes up like 'echo hello w4mo4mr4world', any ideas what I should search for?
tali713
blaenk: this method is flexible and reusable for other situations down the line.
blaenk
sweet thanks tali713
         

tali713
blaenk: I left a lot of fill in the blank, I assume you can figure out how to do the rest.
blaenk
sounds good
tali713
blaenk: oh, obviously you need to put file-name-run-matching in find-file-hook for the second part to be useful.
phreck
er0k.
gnomon
Arvid, I see your question and I agree that it's very weird but I use neither of those tools so I'm afraid I can't help you other than by offering moral support.
so, uh
tali713
blaenk: e.g. (defalias 'finding-read-me (apply-partially 'filename-run-matching "readme"))
gnomon
(Action) offers Arvid moral support
There, there
parsnip
left and right suck because they have different number of characters.
tali713
blaenk: actually as I look at it, I'm not sure the conrtol flow is at all right on that, but... you can figure out what makes the most amount of sense.
ryouma
t and nil do too
blaenk
tali713: yeah no worries
aidalgol
tali713: A few years ago, you suggested the game Flux to me. I have since bought it and it's great fun. So... thanks!
parsnip
ryouma: but they're usually at the end anyways. i want left and right as vars on the left.
tali713
aidalgol: Fluxx? yeah, it's great, and there are a lot of fun <theme> Fluxx. Like "pirate Fluxx"
aidalgol
er, yes *Fluxx
parsnip
heh, python exercise wants me to use recursion. thank you sicp for all you've introduced me to in the short time i put into you.
tali713
sicp is great.
aidalgol
tali713: Did you know that some universities are teaching SICP with Python now?
parsnip
aidalgol: that's the one i'm using now
mit 6.00
tali713
aidalgol: I like that fluxx is pretty easy to deal people into the middle of, and you can teach almost anyone how to play in under two minutes.
aidalgol: I'm pretending that isn't a thing, but I get why.
parsnip
tali713: python and lisp i think have in common how simple they are, though in pretty distinct ways i'm sure.
aidalgol
I've yet to con passersby into joining a game in progress, but I look forward to such an opportunity.
parsnip
i mean, python is not the most hideous language.
bpalmer
rudybot: #emacs is not the most hideous channel.
rudybot
bpalmer: they're jarring and somewhat hideous
tali713
python is okay, and it's popularly used. so using it serves dual purposes.
gnomon
,hideous
fsbot
You will not be elected to public office this year.
tali713
while teaching the SICP in scheme does not give directly marketable skills but is a better way to teach the CS side, IMO.
aidalgol
tali713: exactly. I haven't taken a look at the Python version of any exercises, but I imagine the ones that write specialised languages, such as the picture language example/exercise, would not translate well to a non-homoiconic language.
saimazoon
hello
parsnip
aidalgol: i think the special topics seem to be largely different, though there is some overlap.
they seem to look less at things like meta languages, and more at things like, statistics, etc.
squiddo
homoiconic ftw!
parsnip
but both texts cover things like complexity, etc.
aidalgol
(Action) is tempted to add "no homoiconiphobia" to the /topic
,greet saimazoon
fsbot
Hej saimazoon!
aidalgol
rudybot: I don't always greet newcomers, but when I do, I have the bot do it for me.
rudybot
aidalgol: Is there a good place to look for small, self-contained, good-quality Racket programs (suitable for newcomers to play around with to supplement the Racket Guide)?
Fuco
why "foo{1}".format("bar") gives me IndexError: tuple index out of range ?
oh right, it goes from zero
sometimes it is immediately obvious onceyou ask :D
(Action) facepalms and goes back to learning python
aidalgol
Fuco: the index is not required, BTW.
sometimes more convenient to just use "{}"
pi-alpha
python > lisp
parsnip
,slap pi-alpha
fsbot
(Action) slaps pi-alpha with a large halibut
aidalgol
,flay pi-alpha
fsbot
pi-alpha: May you inherit a hotel with a thousand rooms and be found dead in each one of them
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 next »