HNHacker News
TopNewBestAskShowJobs

kaushalmodi

353 karma · joined July 12, 2016

Loves Emacs and command-line utilities. You can find me by the same username on GitHub, Gitlab, reddit and Twitter.

Blog: https://scripter.co

* Few projects:

- Org-mode + Hugo: https://ox-hugo.scripter.co

- Eless (A Better less): https://eless.scripter.co

submissionscomments
kaushalmodi··on Org-Mode Is One of the Most Reasonable Markup Languages to Use for Text
The plusses of plaintext systems are:

- free data (not locked by proprietary systems like Word) - ability to diff, search easily - ability to quickly refactor (biggest one for me) of not just content but markup too!

Now readability is subjective plus if you know what you are reading.

If you know Org markup, reading even raw Org will be easy. If you know Markdown, reading Markdown will be easy. If you don't know Org, you might think that the headings look like bullets. But that just because you don't know it not because if is less 'readable'.

I linked the raw Org earlier. Here is the Markdown conversion of the the same Org source: https://gitlab.com/kaushalmodi/kaushalmodi.gitlab.io/raw/mas...

To a Markdown-untrained eye, that wouldn't look too "readable".

Now of course, if you use a good editor that allows folding of headings, optional hiding of markup, coloring code blocks in the right syntax, etc, that definitely becomes more readable than raw. The same applies to Markdown.

It's basically -- Pick the right tool to make the experience more pleasant. But even if you use a wrong tool, plaintext content will allow you to get the job done. It's your choosing.

So as I mentioned earlier, "readability" is a perception, subjective to each individual. Based on their experience with plaintext, Org or Markdown "readability" can change. But the plusses of plaintext I mentioned in the very beginning stay unaffected by that.

kaushalmodi··on Org-Mode Is One of the Most Reasonable Markup Languages to Use for Text
There's a big difference between seeing an Org file in raw vs in an editor. This is how I see it: https://ox-hugo.netlify.com/images/ox-hugo-doc-source-viewin...

Also, I prefer not leaving empty blank lines in between. Factors like that can change one's perception of readability.

kaushalmodi··on Org-Mode Is One of the Most Reasonable Markup Languages to Use for Text
See my comment on how to remember the [[more important link][optional description]] order: https://news.ycombinator.com/item?id=15322954
kaushalmodi··on Org-Mode Is One of the Most Reasonable Markup Languages to Use for Text
The way to remember that is that the link is important.

For example, [[www.example.com]] makes sense.. it will render as www.example.com that hyperlinks to that link. But [[link description]] is useless by itself.

So.. put the more important thing first, the link:

    [[www.example.com]]
Now, if you also have a description text for that link, put that afterwards..

    [[www.example.com][link description]]
Hope that helps.
kaushalmodi··on Org-Mode Is One of the Most Reasonable Markup Languages to Use for Text
Shameless plug: https://ox-hugo.netlify.com

I just announced the ox-hugo package. I love the blogging framework of Hugo, but disliked that I needed to manually take care of the post front matter and also noticed the shortcomings of writing in just Markdown. I also missed the tree-based text organization of Org mode. So this package was born.

Writing posts in Org mode gives you all the Org markup power (that's already more than Markdown), plus a lot more! like Org Babel, property inheritance, etc.

An example: I wrote this post ( https://scripter.co/notes/string-functions-nim-vs-python/ ) that's heavy with code blocks and results of evaluating those code blocks. It would be super-painful in Markdown to paste all the code blocks and also their results. In the Org source: https://gitlab.com/kaushalmodi/kaushalmodi.gitlab.io/raw/mas..., each of the #+RESULTS blocks in that Org source are auto generated using the Org Babel feature.

I elaborate more on why I use ox-hugo, or why I use Org for blogging in native Emacs environment here: https://ox-hugo.netlify.com/doc/why-ox-hugo/

Even if one is not using Emacs as their editor, as the OP mentions, the Org markup is simple enough that anyone can use their favorite editor to write in Org. To add to that, using a little Makefile, they can run Emacs in batch mode to take advantage of true Org mode features like Org Babel, etc.

For instance, one can clone the ox-hugo repo, https://github.com/kaushalmodi/ox-hugo/, and just run "make test" or "make doc" to let ox-hugo do its thing, without having anyone to know what to do after opening Emacs, what command to run, etc.

"make doc" will generate all the Markdown content needed for the entire documentation website that I linked in the very beginning of this comment, all from a single Org file.. You cannot do that in Markdown.

kaushalmodi··on Other ways to read Hacker News
Thank you! I had been looking for a way to get reply notifications for very long.
kaushalmodi··on Show HN: Nulis – Open Source Tree Editor for Writers
A simple org-copy-subtree (C-c C-x M-w) and then paste (C-y) would do it. Or did you mean something else?

https://www.gnu.org/software/emacs/manual/html_node/org/Stru...

kaushalmodi··on Show HN: Nulis – Open Source Tree Editor for Writers
As a plain-text editor fan, I use Org mode in Emacs for Tree-based documentation and blogging.
kaushalmodi··on Interesting commands for the Linux shell
From its README:

    rg --type-add 'foo:*.{foo,foobar}' -tfoo bar
---

You simply make the below into an alias:

    rg --type-add 'foo:*.{foo,foobar}'
Or, if the type you need is generic that other users can also use, submit a PR. The developer was kind to except mine.. https://github.com/BurntSushi/ripgrep/pull/107/files .. it's a trivial 1-line PR.
kaushalmodi··on Interesting commands for the Linux shell
Now try rg (ripgrep). It has a much more robust file ignore handling than ag in my experience.

When I last tried, ag couldn't handle this in .ignore file:

    !foo.1
    foo.*
That would ignore all foo.* files except foo.1 in rg.

Also rg is a bit faster than ag for my use cases.

kaushalmodi··on Interesting commands for the Linux shell
And the same for compression..

    tar caf foo.tar.xz foo/
The extension of the file after the `f` switch tells tar what compression to use.

c - compress

a - auto

kaushalmodi··on Building a fast, secured and free static site in less than three hours
Compare that to downloading one statically built Hugo binary :)
kaushalmodi··on Building a fast, secured and free static site in less than three hours
How do you down vote on HN?
kaushalmodi··on Building a fast, secured and free static site in less than three hours
Going along with the joke, that's almost how elisp (most of the other lisps too, I believe) works:

    (if (or cond1 .. condn)
        (progn
          (true1)
          (true2))
      (false1)
      (false2))
But in Go templates, it would be:

{{ if (or cond1 .. condn) }} true1 true2 {{ else }} false1 false2 {{ endif }}

kaushalmodi··on Building a fast, secured and free static site in less than three hours
I have learnt that you can throw in parentheses for readability..

    if (or cond1 cond2)
kaushalmodi··on Building a fast, secured and free static site in less than three hours
+1 for Netlify, and their amazing customer service via chat.
kaushalmodi··on Building a fast, secured and free static site in less than three hours
The author has done a great job of documenting all the low-level details about even how to use git to push stuff to the GitHub repo. Kudos for the excellent documentation.

I use Hugo + Gitlab + Netlify (free https). I use Emacs as my development environment, and Magit (https://magit.vc) has come as a boon to me. All the git shell scripting mentioned in this post reduce to few key strokes with the help of Magit. I'm not intending to divert the topic, but couldn't help mentioning that the Magit Kickstarter [1] needs some love.

Coming back to the Hugo topic, I believe that the 3 hours is a good practical estimate for someone who has never dabbled with git/github, domain control tweaks, CNAME, etc.

So don't take that 3 hour mention as a negative, and jump right into the post. Once you have the whole setup, updating your site is a simple git commit + git push (hardly a minute -- not counting the time it takes to gather content for a new post :)).

[1]: https://www.kickstarter.com/projects/1681258897/its-magit-th...

kaushalmodi··on Gap Buffers Are Not Optimized for Multiple Cursors
It just seems that the author hasn't fully understood the application of multiple cursors.

- Create multiple cursors using mouse clicks. Now the locations you click need not be (1) in a vertical alignment -- if vertically aligned, rectangle edits make sense (2) on identical symbols -- if identical, search/replace makes sense. - Also you don't need to precisely on start or end of symbols. After clicking, I can do `M-b` or `M-f` (or whatever) to bring all cursors at identical syntactic locations. - Even when not using mouse clicks, using multiple cursor is a much lesser cognitive load. If I want to refactor the symbol where the cursor is, I simply select the whole symbol (expand-region package), hit a binding to create multiple cursors at all identical symbol locations in the buffer (not in just the visible region). The OP now counted that as a disadvantage which was odd. I count myself proficient in using multiple cursors and I am confident that each time I do the above, the cursors would be created exactly where they should be (even when those are created outside the visible region). Then I simply type in the new symbol name to replace the selections. If I use search/replace, I need to type in the symbol name and possible regexp to denote the symbol begins and ends. With multiple cursors, no matter what symbol I am on, the action is the same (1) select current symbol (2) create cursors everywhere on such symbols .. no need to type in a specific regexp each time! - Talking about the extra processing the CPU needs to do because of multiple cursors, I have created around 100 cursors in extreme cases and even then it was fine. In regular use, I need to create under a dozen multiple cursors. - Finally the real-time visual feedback completely beats whatever little CPU gains we get by not using the multiple cursors and the extra time wasted in thinking what regexp to type, what macro to define, how big a rectangle selection to make etc. - Also so much more is possible[1]: interactively adding/removing cursors, aligning, inserting numbers, etc. which would be much less efficient the conventional way.

[1]: https://github.com/kaushalmodi/.emacs.d/blob/master/setup-fi...

kaushalmodi··on Using GNU Stow to manage dotfiles (2013)
I use GNU Stow for dotfile management plus version control of various utilities installed locally.
kaushalmodi··on Using GNU Stow to manage dotfiles (2013)
That's a blast from the past. Should the year tag 2012 be put in the title.

I am not denying the usefulness of this post. I came across this when I was setting up stow myself.

kaushalmodi··on A Gentler Introduction to Programming
It would be awesome if the author used Python 3 instead of Python 2 (based on that print statement example).
kaushalmodi··on Remake – GNU Make with comprehensible tracing and a debugger
Mirror on GitHub by the remake author: https://github.com/rocky/remake/blob/remake-4-2/README.md
kaushalmodi··on It's Magit the Magical Git Client by Jonas Bernoulli – Kickstarter
Jonas has been pouring his soul into Magit (and many other OSS projects) for many years now [1]. The project has reached an exemplary status with excellent code quality, documentation and support. Many thanks to Jonas and other Magit contributors!

If you have been reaping the benefits of Magit, and haven't yet got a chance to say thanks, this is an awesome chance :)

Even if you are not using Emacs, but have wished that Magit were available on your favorite editor, then also it would be good to pledge in this KickStarter. See why[2].

And if you haven't yet heard of Magit, check out the KickStarter page!

Good luck Jonas!

[1]: https://github.com/magit/magit/graphs/contributors

[2]: https://emacsair.me/2017/09/01/magit-for-non-emacs-users/

kaushalmodi··on Roamer: A Plain-Text File Manager
Sorry, I was mistaken. I confirm that that works too. I was just comparing with wdired.. wdired (Emacs) creates that foo/ dir if it doesn't exist.
kaushalmodi··on Roamer: A Plain-Text File Manager
Emacs (w)dired can do that in a snap.
kaushalmodi··on Roamer: A Plain-Text File Manager
I just tried qmv, briefly. I couldn't figure out how to move files to a different directory, and create that directory if it does not exist.

Let's say I do:

    qmv a.txt
And I get this in qmv:

   a.txt                   a.txt
This does not work:

   a.txt                   foo/a.txt
I was expecting qmv to create the foo/ directory if it does not exist. Even if it exists, it does not work.

Do you know if this works? If it does, how do I do it?

kaushalmodi··on Laverna – A Markdown note-taking app focused on privacy
That, I have edited as shown (except the snippet outputs). That was an example of using Org Babel. Note that the #+RESULT blocks in that file are all auto-generated; none hand-written.

That post does not have any #+INCLUDE because all the code snippets are trivial. I would use #+INCLUDE in posts where I have a code file, and I want to talk about only few lines from that.

I have different examples of #+INCLUDE in my examples file[1] for my Org to Markdown for Hugo exporter -- ox-hugo[2]. There I use the inbuilt INCLUDE feature where I choose to include only the specified Org sub-tree (using the sub-tree CUSTOM_ID). The above referenced post on Nim/Python is converted to Markdown for Hugo using the same exporter.

[1]: https://raw.githubusercontent.com/kaushalmodi/ox-hugo/master... [2]: https://github.com/kaushalmodi/ox-hugo

kaushalmodi··on Laverna – A Markdown note-taking app focused on privacy
Yes, here's the source:

- source of that specific post in raw org [1] - site source [2]

[1]: https://gitlab.com/kaushalmodi/kaushalmodi.gitlab.io/raw/mas...

[2]: https://gitlab.com/kaushalmodi/kaushalmodi.gitlab.io

(I wish HN supported some markup :P)

kaushalmodi··on Laverna – A Markdown note-taking app focused on privacy
Sure, here it is: https://github.com/kaushalmodi/.emacs.d/blob/master/elisp/or...
kaushalmodi··on Laverna – A Markdown note-taking app focused on privacy
> Emacs, and is on its way out

Being active on the Emacs and Org mode mailing lists, and other forums, I can say with confidence that this is not true.

In fact, I am seeing active development in both Emacs and Org; not just bug fixes, but frequent additions of new features.

> org-mode is only any good if you're using the full power of it (tasks, agenda, etc), which is buying into

Org markup is much more powerful than Markdown. So you can be much more productive by using Org just as markup. One example is '#+INCLUDE: "foo.py" :lines-5-10'.. This is tremendously useful if you are writing notes that export to some format or blogging.. you don't need to copy-paste code snippets, Org will fetch them for you. (I have a customization built on top of that.. instead of specifying the line numbers, I can specify the start and end regexp for the lines containing my snippet). Add org-babel to this mix, and you don't even need to run the snippets, and copy the results manually; again Org does it.

I recently blogged about comparing string related functions between Python and Nim: https://scripter.co/notes/string-functions-nim-vs-python/

I cannot imagine myself writing (and maintaining) that post in Markdown!

On the next update of Nim version, I'll simply run org-babel over the whole file, see git diff to check if anything major has changed, and update the post accordingly.. no copy/pasting ever :)

> a system that's soon going away.

Again, really? What made you think that?

← PreviousPage 6 of 8Next →