Fork me on GitHub
#emacs
<
2018-01-05
>
vemv00:01:04

new to helm, chose the helm-ag variant I think I understood the basics, but I can't properly do the "replace" part of my "search and replace" intent I can choose a directory to search in (OK) search for a pattern (OK), choose candidates / all of them (OK), and then choose 1 of the 4 offered actions the problem is that none of the 4 offered actions means "apply a replacement string". These are the actions offered by helm-do-*: * Open file * Open file other window * Save results in buffer * Edit search results "Edit search results" works, but it seems more than I want. I don't want to do arbitary edits on the matching lines. I want to type <replacement string> and have it applied to each occurrence in those lines.

vemv00:01:26

my guess is that there is an action other than Edit search results which does precisely that?

qqq00:01:17

yes, there is

qqq00:01:25

let me find it from my init.el

qqq00:01:58

I think the functino you want is 'projectile-replace', it's part of the projectile librtary, which means you have to attach it to a particular project/directory

qqq00:01:20

the way it works is you type the search string, the replace string, then it interactivle asks you: repalce this instane? replace all in this file? ...

qqq00:01:28

I'm a big fan of it.

vemv00:01:53

that'd work for sure but for now I'm avoiding projectile

qqq01:01:25

in evil/emacs, how to I say: take the current line shift the view/buffer/window so that the current line is at the to pof the screen/window

jeff.terrell13:01:51

Same as in vim: zt. Also zb for the bottom of the screen and zz for the center.

dpsutton02:01:05

@vemv are you avoiding projectile for a reason or have a different preferred setup?

vemv02:01:01

no specific bias againt it, simply I try to use small libraries whenever possible

vemv03:01:58

Kinda solved, time will tell if my solution is good enough

vemv03:01:42

From what I researched, this one of those functionalities that Emacs / libraries will never provide out-of-the-box

gonewest81806:01:13

@qqq well the function would be (recenter-top-bottom 0)… I don’t use evil-mode, so I don’t know if there’s already a binding for that.

bozhidar10:01:48

@vemv Helm is orders of magnitude bigger than Projectile. 😄

bozhidar10:01:43

Obviously I’m quite attached to Projectile, because I wrote it, but I’ve never liked the huge scope of Helm. I was pushing hard back in the back to split this to some core framework, so people could actually have small add-ons to it. If you want something really simple I’d recommend counsel - https://github.com/abo-abo/swiper#counsel It has some basic integration with git and ag.

bozhidar10:01:33

I myself use a combination of Projectile, ivy-mode and counsel depending on what I’m doing.

qqq10:01:45

@bozhidar: you also work at toptal right? is it possible to create a cider-toptal plugin where: 1. when I run into a bug, I can do M-x pay-toptal-$50 2. a toptal expert joins via screen sharing and starts helping me debug my code I'm only half joking, something like this would be a huge productivity gain; it's like aws / uber for clojure expertise

bozhidar11:01:15

Yeah, the team is certainly going to appreciate the idea.

bozhidar11:01:39

How do you know I work there? That surprised me.

qqq12:01:52

https://github.com/bbatsov <-- lists you as VP of Engr at Toptal

qqq12:01:23

@bozhidar: I've been trying to push this idea of "paid stackoverflow" (having played with both upwork and codementor), perhaps toptal can implement this

qqq12:01:30

often times, I run into an engr problem that I make no progress on for 2+ hours, and I just now -- that if only I knew the libs / domain, I could resolve it in 5 mins

qqq12:01:07

in those cases, I'd love to somehow just find that person in the world, who has the expertise and is free at the moment, give them $50, and have them solve the problem for me

bozhidar12:01:32

Haha, I forgot about this. Yeah, I’m the VP of Engineering at Toptal. The company’s huge growth played a big part in me having less time for OSS. That’s a cool idea, I’ll run it by our product team.

qqq12:01:16

I don't know about clojurians-slack policy concerning commercial gigs, but if there were experts here I could dm with #clojure / #emacs / #cider questions at $50 each (help more difficult than what I would expect a random stranger to do for free), it'd be interesting to see how it works out

richiardiandrea15:01:31

I remember this from a while back, there are plenty of platforms now but the most promising one is https://openbounty.status.im/app IMHO.

benedek13:01:22

deffo an interesting idea

benedek14:01:25

wonder if the cider team could support that in a way that a cut from the fee would go into a cider pot and could be used to fund cider work (solving cider issues, new features etc)

bozhidar14:01:01

While nobody does OSS for money, making some money from working on some ticket certainly increases your motivation.

gfredericks15:01:36

I'm seeing strange behavior from cider-pprint-eval-last-sexp-to-comment

gfredericks15:01:30

in particular, there is no change on the screen immediately after running it. if I move the cursor, the output appears. But when using linum mode, the line numbers haven't changed yet (in the case where the output is multi-line); moving the cursor a second time updates the line numbers

gfredericks15:01:16

when I add indirection via my own defun for the purpose of binding C-x C-e to something that pretty prints to the repl or buffer, the first problem goes away, but the second doesn't

gfredericks15:01:16

should I just make a github issue? can anybody recommend a workaround for the linum-mode problem? (I couldn't find any linum-related functions available at all, so wasn't sure what to try)

bozhidar15:01:05

Sounds like some problem I’ve seen reported somewhere else recently. Might be good to file a ticket with some repro steps.

gonewest81816:01:01

@gfredericks I saw something like this during development, and put some notes in the pull request. The underlying problem I saw was the mechanism in emacs that suggests abbreviations for long function names (messages like “you can also invoke that function with M-x s-r-g”). Those abbreviations are computed on the fly, and there’s a caveat in the core about the possible delay.

gonewest81816:01:14

Anyway, the thing is, the abbreviations thing doesn’t happen if you’ve already bound a key to that function. In that case you’ve seen the message reminding you of the key binding.

gfredericks16:01:33

Okay, so that explains why the first effect went away when I set a keybinding

bozhidar16:01:22

We might put this in the troubleshooting section of the manual.

bozhidar16:01:30

I keep forgetting about this new Emacs functionality.

bozhidar16:01:48

Or display some message linking to this when people are running a newer Emacs.

gonewest81816:01:18

Have you tried just waiting it out? I can’t recall, but I think there is a timer in there to make sure these abbreviations aren’t clobbering other output to the minibuffer.

gfredericks16:01:07

Which effect are you referring to?

gonewest81816:01:33

The second( Not suggesting you want to work that way, just curious if the line numbers and so on would eventually update by themselves.)

gfredericks16:01:45

How long should I wait?

gfredericks16:01:00

(it's been at least a minute)

gonewest81816:01:19

I’d say that’s Long enough...

gfredericks16:01:00

I'm doing this on an unconfigured emacs 26.0.50.2, btw, so hopefully that means it's reproducible

gonewest81817:01:07

fwiw, I can reproduce the linum-mode interaction in Emacs 25.3.1 also.

dpsutton17:01:58

i think eli has made a native line numbers implementation in c in emacs. it's annoying when people suggest changing your workflow but i think its supposed to solve some issues and might be worth looking at

dpsutton17:01:47

display-line-numbers-mode seems to be how to toggle it

bozhidar17:01:21

@dpsutton When was this added?

dpsutton17:01:29

(setq display-line-numbers 'relative) ah nice

dpsutton17:01:46

not sure. i was browsing the list and saw eli had added it and was asking for feedback. looks new in 26

bozhidar17:01:07

Which is still unreleased. 😉

bozhidar17:01:19

Might checkout the current state, though.

dpsutton17:01:32

oh it is? i forget where things are. i build from git and mine says 27 so i figured 26 was out

dpsutton17:01:49

reddit comments about it submitted by eli with a link to the mailing list if you prefer

bozhidar17:01:06

Yeah, 26 was branched as it’s near a release and the master is now 27.

bozhidar17:01:45

I was also building Emacs from bzr and then git for a long time, but stopped at some point as often I’d encounter bad builds and just waste some time.

dpsutton17:01:48

i'm loving it because i got the new xreffind-defintiions` early which was amazing in 25

dpsutton17:01:00

and i only build new versions every few months so i don't run into issues

vemv17:01:08

> Helm is orders of magnitude bigger than Projectile. 😄 (edited) but helm-ag seemed (subjectively) a bit more focused in goals than projectile. I already had some project-management code, didn't want conceptual overlap helm looked scary from the beginning, but used as the implementation detail of X (helm-ag in this case) it gets more acceptable anyway, just sharing my reasoning. Projectile seems pretty awesome, I hear it's used by many!

cmack17:01:24

I use the two together with helm-projectile

richiardiandrea18:01:57

Hello emacs gurus I have a question

richiardiandrea18:01:32

which creates a list with keywords after the first (main) completion function

richiardiandrea18:01:22

which takes the 4th element and gets a property from it

dpsutton18:01:35

i've looked into company-capf and it is incredibly hard to understand

richiardiandrea18:01:05

oh cool, my experience is limited and I am happy that I am not the only one finding it weird

dpsutton18:01:11

its pulling that from the mutated company--capf-data and i don't understand all of the times it gets set

richiardiandrea18:01:51

I did:

(defvar u (list 3 4 (lambda ()) :annotation-function (lambda (t ))))
(plist-get (nthcdr 4 u) :annotation-function)
but it never works

dpsutton18:01:55

but the 4th cell of that is data. the ones before are buffer, point, and a counter

dpsutton18:01:07

that code is really really weird

richiardiandrea18:01:35

so cider passes a list, I wanted to basically understand how to build that list

richiardiandrea18:01:49

if there was another way then just concatenating

richiardiandrea18:01:46

but I see the only option here seems (concat (list (beg) (end)) (some-of-my-functions-returning-the-rest-as-list)

richiardiandrea18:01:02

@dpsutton should this work in your opinion?

(nconc (list (car bounds) (cdr bounds)
                   (if (fboundp 'completion-table-with-cache)
                       (completion-table-with-cache #'inf-clojure--completions)
                     (completion-table-dynamic #'inf-clojure--completions)))
             (when inf-clojure-completions-annotation-fn
               (list :annotation-function #'inf-clojure-completions-annotation-fn)))

richiardiandrea18:01:37

I am going to try but I think this is the idea I had in mind

dpsutton18:01:19

go for it. i was looking through that exact code for a bug in planck completion interaction. it wasn't fun and i couldn't figure out why the completion function was fired so many times. it gets ... weird. but i don't remember the details righ tnow

richiardiandrea18:01:11

yeah inf-clojure tries its best ... 😄 some quirks are inevitable though..

dpsutton18:01:17

it wasn't inf-clojure i don't think

dpsutton18:01:30

but compeltitions were working. if cljs.c would comple cljs.core/

dpsutton18:01:30

but running completitoin on cljs.core/ would find completitions and then try again. and i think it had to do with the smart completion like breaking up words. like a.i should find assoc-in or something similar. but that would then run a completion for cljs.c and find cljs.core. i gave up on it 🙂

richiardiandrea18:01:03

I am trying to include compliment for clojure types...potentially this opens put for custom completers...at this point an elisp completion common lib for clojure might a good thing

gfredericks22:01:56

what would be the ideal way for users of this tool to get the same effect from inside emacs? https://github.com/gfredericks/how-to-ns I can arbitrarily rearchitect it to support this, but I don't like the idea of having a separate implementation in elisp

vemv22:01:16

@gfredericks personally I use a how-to-ns fork within a file watcher. this file watcher applies how-to-ns and a couple other lein formatters on any individual file change. this is decomplected from lein; which is why I had to fork

gfredericks22:01:42

I'd be happy to untangle it from lein

vemv22:01:00

(emacs integration can be cool, but in the end you're just shaving 1-2 seconds over file-watcher approach)

gfredericks22:01:53

does emacs automatically revert your buffer when a file changes?

dpsutton22:01:02

it's a setting

vemv22:01:32

only problem is that revert is poll-based, a few seconds slower than in other editors

gfredericks22:01:47

so you train yourself to not touch the file for a few seconds after an ns change?

vemv22:01:00

race conditions aren't a risk

vemv22:01:11

if I saved again, my copy would 'win'

vemv22:01:20

that that copy would be reformatted again

vemv22:01:35

no scenario where my changes are eaten

gfredericks22:01:04

oh, so it only reverts if there aren't local changes

gfredericks22:01:08

I need to figure out how to set this up

vemv22:01:19

btw I just realised that you are the author of how-to-ns 🙂

vemv22:01:38

so yeah our file-watcher uses how-to-ns and the newlinetoo

vemv22:01:40

+ cljfmt

vemv22:01:53

all of those had to be forked...

gfredericks22:01:04

newlinetoo == that other thing I made?

vemv22:01:15

*newline one too

gfredericks22:01:31

is cljfmt also too wrapped up in lein, or was that for another reason?

vemv22:01:14

I found I could disentangle all these quickly, since core functionality was in separate non-leiny ns's