rexim / org-cliplink

Insert org-mode links from clipboard
327 stars 11 forks source link

Per-site link formatting #107

Closed azzamsa closed 6 years ago

azzamsa commented 6 years ago

I use org-cliplink dozens times every day. Really grateful for this awesome package.

Most of the time I use it to fetch github repo link. which will result into

- [[https://github.com/uutils/coreutils][GitHub - uutils/coreutils: Cross-platform Rust rewrite of...]]

Can we add org-cliplink config so that it has setting for every site. e.g github. So the result will be

- [[https://github.com/uutils/coreutils][Cross-platform Rust rewrite of the GNU coreutils]]

Or we can add other "string" before the description. e.g "Github : desc"

I think, maybe this https://github.com/rexim/org-cliplink/issues/99 issue also can be solved using this method.

PS: inspired form https://github.com/chitsaou/copy-as-markdown/issues/52

Thank you for this awesome package.

rexim commented 6 years ago

@azzamsa it's already possible to achieve what you want. Please check out Custom Transformers section of the README and let me know what you think. It's not really convenient or intuitive, but you can use the example from there as a temporary workaround until we implement something more friendly.

azzamsa commented 6 years ago

wow, that so fast :).

I tried it. works great for me.

But I still haven't time to hack it. Can org-cliplink recalculate org-cliplink-max-length when the original description trimmed ?

# original
[[https://github.com/rexim/org-cliplink][GitHub - rexim/org-cliplink: Insert org-mode links from c...]]

# custom
[[https://github.com/rexim/org-cliplink][Insert org-mode links from c...]]
rexim commented 6 years ago

@azzamsa no it cannot right now. And I think it's a bug #108. I'll try to find time to fix it this week.

azzamsa commented 6 years ago

At first I thought I don't pay attention to README file. Because this feature already there.

Turn out it just implemented after I opened the issue. I was surprised how fast it is to extend lisp program.

rexim commented 6 years ago

@azzamsa the org-cliplink-max-length recalculation problem should be fixed on the next update.

azzamsa commented 6 years ago

This is the last result I get

[[https://github.com/rexim/org-cliplink][GitHub - rexim/org-cliplink: Insert org-mode links from c...]]

[[https://github.com/rexim/org-cliplink][Insert org-mode links from clipboard]]

Yes, it's differ from this result https://github.com/rexim/org-cliplink/issues/107#issuecomment-410574728

But I still wondering. If we count the first line (fetched using original org-cliplink) the modeline says it's 60 char. But the second line (with custom org-cliplink) just 36 char. Is this by design ?

rexim commented 6 years ago

@azzamsa I'm not sure if I understand you.

Right now org-cliplink-insert-transformed-title:

If the title fits org-cliplink-max-length after the transformation it will not be cut. And this is exactly what we see in your case.

azzamsa commented 6 years ago

Oh, sorry.

I didn't notice that this repo description is only:

Insert org-mode links from clipboard

Which is has maximum string length 36. So I thought the calculation was wrong. Now I tried to the longer string.

[[https://github.com/donnemartin/system-design-primer][GitHub - donnemartin/system-design-primer: Learn how to d...]] 
# length result = 177

[[https://github.com/donnemartin/system-design-primer][Learn how to design large-scale systems. Prep for the sys...]]
# length result = 177

Everything is OK and the calculation is works.

Thanks a lot for org-cliplink. I don't know how to say thanks. You are very kind.

azzamsa commented 6 years ago

Thank you so much for org-cliplink. Thank you.