HNHacker News
TopNewBestAskShowJobs

drothlis

720 karma · joined February 15, 2009

https://stb-tester.com/ | https://david.rothlis.net/ | david@rothlis.net
submissionscomments
drothlis··on Learn to read the source, Luke
Some environments make it easier to browse the source than others. See for example the way you would figure out how to customize indentation in Emacs, by asking Emacs for the source code to the command that is run when you press TAB: http://david.rothlis.net/emacs/customize_c.html#style

(Note that the above refers to browsing the source of Emacs itself, not using Emacs to browse any arbitrary source -- unfortunately the tools for that are still very primitive).

drothlis··on Wkhtmltopdf, shell utility to convert html to pdf using webkit rendering engine
Not to mention that Prince XML has excellent support for CSS paged media (margins, page breaks, headers & footers, etc). Contrast with the printed output of any major browser -- they're all quite disappointing.

It would be nice if that $3800 included free upgrades to subsequent releases, though...

drothlis··on How to learn Emacs
Thanks for the tip. Where did you get this installer from? I just installed emacs-23.4-bin-i386.zip from http://ftp.gnu.org/pub/gnu/emacs/windows/ on a Windows VM, and it's a plain zipfile you extract to C:\Program Files (and optionally run addpm.exe for start menu shortcuts) and it just works -- except for things like grep, which require cygwin or equivalent.

Did your installer also install the cygwin (or equivalent) tools?

drothlis··on How to learn Emacs
Thanks. :-) http://www.emacswiki.org/emacs/LearningEmacs
drothlis··on An Emacs conference
Would there be space for a hands-on workshop for new users? What would such a workshop cover?
drothlis··on An Emacs conference
Thanks! After "pretend that if is a function" I do immediately proceed to explain evaluation semantics: "what does it mean by 'if is a special form'? It turns out that if isn’t a regular function." Of course, I am open to suggestions for better wording etc.

That's assuming you were talking about the "cc-mode customization" chapter. If I've called "if" a function anywhere else please let me know! And keep the feedback coming. :-)

drothlis··on An Emacs conference
I recently put this guide together: http://david.rothlis.net/emacs/howtolearn.html

Its focus is on self-driven discovery by leveraging the Emacs built-in help and source code. Feedback welcome.

drothlis··on The Tyranny of the Diff
We have `diff -w` for this type of thing (and `git diff -w` etc). Sadly, we're still missing `git annotate -w`.
drothlis··on The Tyranny of the Diff
I don't know if this is what you mean, but I use version-control diff, log, and annotate ("blame") extensively for finding the commit that introduced a particular feature, in the hope that the commit message or the diff for the entire changeset will shed some light.

Emacs has tools that make this fairly easy with any version-control system supported by Emacs.[1]

Presumably some of the web-based browsers provided by version-control tools offer the same functionality, but every one I have seen lacks the crucial feature of re-running "annotate" again starting from the revision just before the revision that last changed line X. Otherwise you're looking at "annotate" output for a whitespace change, and to get to something useful you must manually get the log for the file, find the previous revision to what "annotate" was reporting, and run "annotate" again from there.

I've also toyed with storing documentation in commit messages themselves. For example, I wrote a blog post[2] where all the code samples in the article reflect files tracked in a version-control system, evolutions in the code samples are different commits, and the text of the article itself is taken from specially-annotated text in the commit messages. Turns out (surprise surprise!) that this is totally unmaintainable, but it was a fun exercise.

Do you have any concrete examples/writeups of your approach?

[1] http://david.rothlis.net/emacs/basic_c.html#annotate

[2] http://david.rothlis.net/d/templates/

drothlis··on The Tyranny of the Diff
git-gui (part of the core git distribution) provides similar mousey-clicky staging -- you can stage hunks or individual lines at a time.
drothlis··on The Tyranny of the Diff
Basically, yes. It does mean more work for you, for the benefit of the reviewers of the code. Arguably, it is more important to optimise for the readers of the change (many people, spread over time) than for the writer (one person, once).

If you use, say, git, you might commit every single, tiny change separately, on a private (local) branch; then use `git rebase --interactive` to reorder/merge the commits as necessary. This is the easiest way I have found, but it still involves more work.

If you wanted to take it further, you could have your editor automatically commit on every save, with a post-commit hook that takes your changes into a staging area, compiles/tests, and provides a report for each commit.

drothlis··on Efficiently Browsing Text or Code (esp. with Emacs)
Google are planning on open sourcing a DSL for searching c++, apparently. http://www.youtube.com/watch?v=mVbDzTM21BQ
drothlis··on Free your technical aesthetic from the 2010s
Except for the article's steps 3 & 4:

  3. You enter some code and hit proceed
  4. The app continues like nothing happened
A short (<3min) video demoing the same: http://vimeo.com/27850933
drothlis··on Ask HN: Is there really bloat in Rails and if so where is it?
"Bloat" = "Bigger than the framework I know"
drothlis··on Uses of git
I thought that the grand-parent comment referred to sentences such as this from the article:

"Git can be used as a database for your application."

If you intend to distribute your application, even though you're not copying the git source code directly, nor linking your application directly against a git library, the GPL is rather ambiguous.

"Pipes, sockets and command-line arguments are communication mechanisms normally used between two separate programs. So when they are used for communication, the modules normally are separate programs. But if the semantics of the communication are intimate enough, exchanging complex internal data structures, that too could be a basis to consider the two parts as combined into a larger program." -- http://www.gnu.org/licenses/old-licenses/gpl-2.0-faq.html#Me...

drothlis··on Uses of git
Have you seen Ward Cunningham's "federated wiki"?

http://wardcunningham.github.com/

drothlis··on Why, oh why, do those nutheads use vi?
You didn't specify an operating system, but for OS X there's KeyRemap4MacBook[1]. Among a zillion other things, it has a setting for "Ubiquitous Vim Bindings" which enables vi-like bindings everywhere, except in terminals, emacs, and vi itself. And some things like password dialog boxes default to insert mode.

I'm not a vi person myself so I can't comment on how effective it is, but I do use KeyRemap4MacBook to enable certain system-wide emacs/readline-like keybindings that are missing (C-w for backward-kill-word, C-m for return) and some ergonomic tweaks (Return key mapped to Control when held down, because I don't have a right-hand Control key on my keyboard).

[1] http://pqrs.org/macosx/keyremap4macbook/

drothlis··on Zsh is your friend.
Yes. My original comment (the grandparent to your comment) attempted to explain why I prefer term-mode over shell-mode.
drothlis··on Zsh is your friend.
Edit: I meant term-mode (M-x term), not terminal-mode (M-x terminal-emulator). No idea why there are two different terminal emulators in Emacs, but 'M-x term' seems the better of the two, or at least the keybindings make more sense to me.

There is also 'M-x serial-term' should you ever need it.

drothlis··on Zsh is your friend.
Bash configuration for shared history:

  # Append to ~/.bash_history instead of overwriting it -- this stops terminals
  # from overwriting one another's histories.
  shopt -s histappend
  # Only load the last 1000 lines from your ~/.bash_history -- if you need an
  # older entry, just grep that file.
  HISTSIZE=1000
  # Don't truncate ~/.bash_history -- keep all your history, ever.
  unset HISTFILESIZE
  # Add a timestamp to each history entry.
  HISTTIMEFORMAT="%Y/%m/%d %H:%M:%S  "
  # Don't remember trivial 1- and 2-letter commands.
  HISTIGNORE=?:??
  # What it says.
  HISTCONTROL=ignoredups
  # Save each history entry immediately (protects against terminal crashes/
  # disconnections, and interleaves commands from multiple terminals in correct
  # chronological order).
  PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
drothlis··on Zsh is your friend.
One of my favourite aspects of rc is the sane array handling.

In bash: $array expands to the _first_ element of the array; you have to say ${array[@]} to get the whole array. And then you have to quote it in case one of the elements has spaces.

In rc: $array expands to the whole array, and the expansion is _not_ re-parsed, so if an element of the array has spaces in it, it is still considered a single element after the array variable expansion.

For this reason rc doesn't even need double-quoting; it only has single-quoting for escaping spaces in string literals.

drothlis··on Zsh is your friend.
I like the idea, but I'm too used to bash's autocompletion (the Emacs-provided autocompletion is similar but not quite the same), the autocd option, CDPATH, etc. And changing directories in the shell with anything other than cd (pushd, or an alias or script) confuses Emacs's directory completion.

The last couple of days I've been trying terminal-mode rather than shell-mode, and it works much better. Many standard Emacs keybindings get remapped though.

drothlis··on Ruby Frameworks? Which one? Bye bye Rails.
Yes, I particularly enjoyed applying security fixes from the so-called stable branch and suddenly having all my validation messages corrupted, or form parameters randomly truncated.[1]

[1] http://david.rothlis.net/rails/experience_report/#stable_bra...

drothlis··on UK network o2 send your number to every site you visit
It also affects GiffGaff, a "virtual network operator" that uses O2's network.
drothlis··on Sublime Text 2 Beta released with Auto-complete and Improved UI
https://github.com/rails/rails/blob/2-3-stable/actionpack/li...

Try getting your editor to find that definition of method "accept_language" or "cache_control". :-)

drothlis··on Why is “Everything is a File” unique to Unix operating systems?
What does "operating on the namespace" mean?
drothlis··on Ask HN: Which Emacs commands do you find most useful?
C-h:

'C-h S' to get help on that obscure bash built-in or elisp function,

'C-h v' to get help on an elisp variable (most modes offer a lot of customisation via setting particular variables),

'C-h m' to show the current mode's keybindings,

'C-h k' to find the name of the function bound to a particular key sequence,

'C-h t' for a tutorial on all the basic (and not so basic) editing & buffer/window management commands,

and 'C-h ?' to get a list of other help commands.

drothlis··on Dart language
A few weeks ago I whipped up this 3-minute video showcasing a Smalltalk class browser, method finder, and debugger: http://vimeo.com/27850933
drothlis··on Dart language
Certainly feasible: Smalltalk debuggers do this. And Smalltalkers (allegedly) use a workflow just like you describe.
drothlis··on Dart language
From their "technical overview" page http://www.dartlang.org/docs/technical-overview/ :

"Dart will include a rich set of execution environments, libraries, and development tools built to support the language. These tools will enable productive and dynamic development, including edit-and-continue debugging and beyond—up to a style where you program an application outline, run it, and fill in the blanks as you run."

Sounds like a Smalltalk-style debugger running in the browser.

Though it seems these tools aren't actually ready yet: "This is a technology preview, not a product launch" -- http://dartinside.com/2011/live-from-dart-launch/#liveblog-e...

← PreviousPage 7 of 9Next →