From ce6d2a4d3564aa48557b3ff6b13bfb41b6d01df1 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sat, 3 Jan 2015 02:54:37 +0100 Subject: [PATCH] Add old posts --- clark_010.post | 34 ++++++ dispass.el-features.post | 33 +++++ filtering-org-tasks.post | 85 +++++++++++++ highlight-vc-diffs.post | 74 ++++++++++++ markam_v020.post | 44 +++++++ new-tag-pages.post | 17 +++ notstumpwm.post | 121 +++++++++++++++++++ org-examples-on-github.post | 32 +++++ rlwrapping_sbcl.post => rlwrapping-sbcl.post | 0 9 files changed, 440 insertions(+) create mode 100644 clark_010.post create mode 100644 dispass.el-features.post create mode 100644 filtering-org-tasks.post create mode 100644 highlight-vc-diffs.post create mode 100644 markam_v020.post create mode 100644 new-tag-pages.post create mode 100644 notstumpwm.post create mode 100644 org-examples-on-github.post rename rlwrapping_sbcl.post => rlwrapping-sbcl.post (100%) diff --git a/clark_010.post b/clark_010.post new file mode 100644 index 0000000..9d10c24 --- /dev/null +++ b/clark_010.post @@ -0,0 +1,34 @@ +;;;;; +title: CLark 0.1.0 +tags: projects, clark, markam, common-lisp, lisp +date: 2013-04-03 23:04 +format: md +;;;;; + +A few days ago I tagged +[CLark 0.1.0](http://code.ryuslash.org/cgit.cgi/clark/tag/?id=0.1.0). + +CLark is a Common Lisp rewrite of my +[Markam](http://code.ryuslash.org/cgit.cgi/junk/markam/) project, +which in turn was a Chicken Scheme rewrite of +[linkwave](http://code.ryuslash.org/cgit.cgi/junk/linkwave/). With +each rewrite I come a step closer to having the program that I need. +Linkwave could only store bookmarks, Markam could also search through +them and had a conkeror interface which allowed adding and searching +through bookmarks. Now CLark expands upon this by allowing users to +edit their bookmark's information, changing the tags, removing +bookmarks, writing their own commands, an improved command-line +interface and bookmark status checking (bookmarked or not). It also +adds commands to conkeror for the data manipulation commands that are +new (edit, set-tags, remove) and a mode-line indicator of bookmarked +status. + +For now it only targets [SBCL](http://sbcl.org/), but I'm not averse +to including others. + +The next big step should be adding a mcclim-based GUI for those crazy +people who don't like to use the command line. + + + + diff --git a/dispass.el-features.post b/dispass.el-features.post new file mode 100644 index 0000000..588c205 --- /dev/null +++ b/dispass.el-features.post @@ -0,0 +1,33 @@ +;;;;; +title: dispass.el features +tags: projects, dispass, dispass.el +date: 2013-01-20 17:06 +format: md +;;;;; + +Today I've added 3 new features to +[dispass.el](http://ryuslash.org/projects/dispass.el.html): + +- Add support for different algorithms. +- Add support for different sequence numbers. +- Add support for different labelfiles. + +With these changes the functionality offered in +[dispass.el](http://ryuslash.org/projects/dispass.el.html) should be +on-par with the ones found in [DisPass](http://dispass.babab.nl), +which is a nice milestone. + +There is one little bug that we're both working on at the moment, if +you have a label that is also a substring of one of your other labels +it won't work in +[dispass.el](http://ryuslash.org/projects/dispass.el.html), but we're +working on fixing this case in [DisPass](http://dispass.babab.nl). + +Now we wait untill [DisPass](http://dispass.babab.nl) gets another +release and as of then we will try and keep up with both the stable +releases of [DisPass](http://dispass.babab.nl) and the development +version. + + + + diff --git a/filtering-org-tasks.post b/filtering-org-tasks.post new file mode 100644 index 0000000..1678cca --- /dev/null +++ b/filtering-org-tasks.post @@ -0,0 +1,85 @@ +;;;;; +title: Filtering org tasks +tags: tips, emacs, org-mode +date: 2013-08-25 00:38 +format: md +;;;;; + +I want to be able to easily see a list of tasks that are relevant to +the currently loaded desktop file. As I use `desktop.el` as a kind of +project system, this means I only want the tasks for the project I'm +currently working on. + +First I wrote the `tagify` function, because `org-mode` tags can't +contain `.` or `-` characters (among others I'm sure, but these are +the only ones that have caused me any trouble so far). It's a simple +string replacement: + +``` emacs-lisp +(defun tagify (str) + "Remove dots, replace - with _ in STR." + (replace-regexp-in-string + "-" "_" (replace-regexp-in-string "\\." "" (downcase str)))) +``` + +Then I wrote a function to filter the task list by not showing +anything that wasn't tagged with the name of the currently loaded +desktop, unless it isn't tagged at all or no desktop has been loaded. +And set this function to be the value of +`org-agenda-before-sorting-filter-function`. + +``` emacs-lisp +(defun filter-by-desktop (entry) + "Return ENTRY if it has no tags or a tag corresponding to the desktop." + (require 'desktop) + (let ((label (when desktop-dirname + (tagify (file-name-base + (directory-file-name + (expand-file-name desktop-dirname)))))) + (tags (get-text-property 0 'tags entry))) + (when (or (null desktop-dirname) (null tags) (member label tags)) + entry))) + +(setq org-agenda-before-sorting-filter-function #'filter-by-desktop) +``` + +This works fine. I keep untagged tasks in the list as well because +they might be important at all times and I don't want them falling +through the cracks. I also want a complete list if no desktop has been +loaded so I can browse through my tasks and decide what I'm going to +do next. + +The downside of this solution is that I have to close my current +project in order to see the whole list. + +Then I discovered the `/` key in the agenda buffer. I can't believe I +didn't notice this key before. Anyway, that changed my solution. + +Instead of setting `org-agenda-before-sorting-filter-function` I add a +hook to the `org-agenda-finalize-hook`. The `filter-by-desktop` +function looks a little different now: + +``` emacs-lisp +(defun org-init-filter-by-desktop () + "Filter agenda by current label." + (when desktop-dirname + (let ((label (tagify (file-name-base + (directory-file-name + (expand-file-name desktop-dirname)))))) + (org-agenda-filter-apply (cons label nil) 'tag)))) + +(add-hook 'org-agenda-finalize-hook 'org-init-filter-by-desktop) +``` + +I don't need to compare any tags now, and if I want to see my entire +list of tasks I can easily just press `/ /`. Since it is easier to get +back to the overview of my tasks it also doesn't bother me so much +that this way any untagged tasks don't show up in the filtered buffer. + +I haven't stopped using `/` since I discovered it. Filtering in this +way is one of the things I like about `ibuffer` as well, now for +`org-mode` it works excellently as well. + + + + diff --git a/highlight-vc-diffs.post b/highlight-vc-diffs.post new file mode 100644 index 0000000..72bfe33 --- /dev/null +++ b/highlight-vc-diffs.post @@ -0,0 +1,74 @@ +;;;;; +title: highlight VC diffs +tags: tips, emacs, git, vc, diff +date: 2013-01-25 02:20 +format: md +;;;;; + +Sometimes you come across these gems of packages that seem to fulfill +a wish that you didn't even realise you had. + +Today I came across +[git-gutter](https://github.com/syohex/emacs-git-gutter) for Emacs and +its companion +[git-gutter-fringe](https://github.com/syohex/emacs-git-gutter-fringe), +which are apparently based on an extension for Sumblime Text 2. These +show the status of changes in a special "gutter" next to the fringe or +in the fringe itself. This is very cool stuff. + +To enable it I added the following code to my Emacs init file: + +``` emacs-lisp +(eval-after-load "git-gutter" '(load "git-gutter-fringe")) + +(defun maybe-use-git-gutter () + "Run `git-gutter' if the current file is being tracked by git." + (when (eq (vc-backend (buffer-file-name)) 'Git) + (git-gutter))) + +(add-hook 'after-save-hook 'maybe-use-git-gutter) +(add-hook 'after-change-major-mode-hook 'maybe-use-git-gutter) +(add-hook 'window-configuration-change-hook 'maybe-use-git-gutter) +``` + +`git-gutter` was easily installed through MELPA, but I had to download +`git-gutter-fringe` separately and use `package-install-file` to +install that. + +I had to load `git-gutter-fringe` manually because it didn't seem to +have any autoloads defined, and I had to run it using these three +hooks because the information seemed to disappear if I switched +windows and came back, didn't automatically update after saving and +didn't automatically show anything when first loading the file. This +was all fine, since just calling the function updates the buffer it's +easy to use this way. + +Later, though, I stumbled upon +[diff-hl](https://github.com/dgutov/diff-hl) by accident. I was +looking for anything involving the fringe, which I think, for the most +part, is underused. + +It does pretty much the same thing, except that it does so at least +for git, bazaar and mercurial (according to the readme). It also +defines some commands for working with the blocks of changes, like +navigating between them and reverting them. It uses the fringe by +default, and doesn't require a separate package to be installed. And +it's much easier to set up. + +It can also be installed through MELPA, and afterwards it's just a +line in our init file away: + +``` emacs-lisp +(global-diff-hl-mode) +``` + +Of course if you don't want it enabled globally you can call +`diff-hl-mode` from some hooks, but this way works fine for me. + +It's funny how I had no idea these existed, didn't even think about +needing/wanting this feature and then finding two of them in the same +day. + + + + diff --git a/markam_v020.post b/markam_v020.post new file mode 100644 index 0000000..444e451 --- /dev/null +++ b/markam_v020.post @@ -0,0 +1,44 @@ +;;;;; +title: Markam v0.2.0 +tags: projects, markam +date: 2013-02-16 11:37 +format: md +;;;;; + +I've just pushed version 0.2.0 of my project +[Markam](http://projects.ryuslash.org/markam/). It took longer than I +thought it would. Since storing was still all I wanted to do I had no +rush to add anything else. Until now. + +Changes include: + +- Add `install`, `uninstall` and `install-strip` targets to the + Makefile, this should make installing easier. + +- Add simple tag/title searching. Looks through bookmarks for any that + have been tagged with the given string, or that have it somewhere in + their title. + +- Add a `--script` switch, which changes output for both the default + and search behavior. When this switch is passed to markam it outputs + the name, description and url of each bookmark, where each bookmark + is separated by `C-^` + ([Record separator](http://en.wikipedia.org/wiki/Record_separator#Field_separators)) + and each field by `C-_` + ([Unit separator](http://en.wikipedia.org/wiki/Unit_separator#Field_separators)). + This should help in building tools around it by making parsing + somewhat easier. The bundled [Conkeror](http://conkeror.org) + interface uses it. + +- Update the [Conkeror](http://conkeror.org) interface: + + - Add the commands `markam-find-url` and + `markam-find-url-new-buffer`. These call markam with a possible + search string and add them as completion candidates, for easy + searching and opening of your bookmarks. `markam-find-url` uses + the current buffer and `markam-find-url-new-buffer` opens the url + in a new buffer. + + + + diff --git a/new-tag-pages.post b/new-tag-pages.post new file mode 100644 index 0000000..d444a38 --- /dev/null +++ b/new-tag-pages.post @@ -0,0 +1,17 @@ +;;;;; +title: New tag pages +tags: meta, tekuti, dispass.el +date: 2013-04-03 03:33 +format: md +;;;;; + +I've changed my tekuti instance to have tag pages that look more like +the index page. I did this so that I can use tag pages as news pages +for my various projects. You may have a look at the +[dispass.el](http://projects.ryuslash.org/dispass.el) project site to +see the new "Read News" link, which will take you to the +[dispass.el tag page](http://blog.ryuslash.org/tags/dispass.el). + + + + diff --git a/notstumpwm.post b/notstumpwm.post new file mode 100644 index 0000000..244fad5 --- /dev/null +++ b/notstumpwm.post @@ -0,0 +1,121 @@ +;;;;; +title: Notstumpwm +tags: experiments, notion, wm, lua, config, stumpwm, lisp, archlinux, exherbo +date: 2013-05-24 00:10 +format: md +;;;;; + +I have just returned from an excursion into the land of +[exherbo](http://exherbo.org/), which is an awesome source-based +distro, and I found that while I was gone, something changed that made +[stumpwm](http://www.nongnu.org/stumpwm/) cause a segmentation fault +in X11 a few seconds after starting up. + +I have tried everything I can think of to get it running again, but +alas, to no avail. So I started looking at alternatives again. Feeling +a little crazy I decided to give [notion](http://notion.sf.net) +another try. And it fits strangely well. + +It's configured/extended in lua, which I'm not particularly fond of, +and it has a (in my opinion) crazy default configuration. **But** it +also allows Emacs-like key combinations out-of-the-box, which is a +very big plus in my book. So the quest to bring it closer to my +stumpwm setup has begun. + +## Window layout + +One of the nicest additions to my stumpwm configuration I made in the +last few weeks was a loaded window configuration which put my Emacs +frames in a big chunk of my left monitor, my terminals on my left +monitor with just enough space for 80 columns and my web browser +filling my right screen. I had also set-up some rules to always place +them in the correct spots. + +I have not yet tried to automatically place the windows in the right +spots, but I do have the proportions right. I just had to delete the +right frames and resize the one for terminals and, by default, notion +remembers this set-up and automatically restores it when I log in. + +I will look at creating a special layout for this so I don't have to +worry about (accidentally) changing things. + +## run-or-raise + +I found this interesting +[page](http://www.xsteve.at/prg/ion/ion3_functions_xsteve.lua) about +`run-or-raise`-like functionality for Ion3, which notion is a fork of. +This is a little outdated, though, since notion has changed +(apparently) the workings of some functions and lua 5.2 introduced the +goto keyword, so I had to change it to this: + +``` +function oni_match_class(class) + local result = {} + ioncore.clientwin_i( + function (win) + if class `` win:get_ident().class then + table.insert(result, win) + return false + end + return true + end + ) + return result +end + +function xsteve_run_byclass(prog, class) + local win = oni_match_class(class)[1] + if win then + win:goto_() + else + ioncore.exec(prog) + end +end +``` + +There is no function to get a list of all the client windows, only a +function to iterate over them. For the moment I am only interested in +finding the first window with class CLASS, so I return `false` when a +match is found, this stops the iteration process. I also had to use +the `WRegion.goto_` function, instead of `WRegion.goto` because of the +mentioned change in lua 5.2, but they are the same. + +I then only have to bind it: + +``` +defbindings("WScreen", { + -- ... + submap("Control+Z", { + -- ... + kpress("E", "xsteve_run_byclass('emacsclient -ca emacs', 'Emacs')"), + kpress("W", "xsteve_run_byclass('conkeror', 'Conkeror')"), + kpress("C", "xsteve_run_byclass('urxvt', 'URxvt')"), + }), +}) +``` + +## Quoting C-z + +One of the coolest things about using a prefix in stumpwm that I have +been able to find in precious few other solutions is the ability to +send the prefix key to the applications you use, so you don't entirely +miss its functionality. In stumpwm this is easy, but in notion its a +little more work: + +``` +defbindings("WClientWin", { + -- ... + submap("Control+Z", { + -- ... + kpress("Q", "WClientWin.quote_next(_)"), + }), +}) +``` + +This means that I have to type `C-z q C-z` to send the `C-z` key to, +for instance, Emacs. That a few more keys than I was used to in +stumpwm, but at least it's possible. + + + + diff --git a/org-examples-on-github.post b/org-examples-on-github.post new file mode 100644 index 0000000..68c77c0 --- /dev/null +++ b/org-examples-on-github.post @@ -0,0 +1,32 @@ +;;;;; +title: Org examples on github +tags: github, org-mode, emacs +date: 2013-01-20 14:09 +format: md +;;;;; + +[github](http://github.com) has an org-mode parser for their README +files, but I always thought it didn't handle `#+BEGIN_SRC` and +`#+BEGIN_EXAMPLE` style blocks. And I'm not wrong, but it does handle +`:` blocks. + +So this won't work: + +``` +#+BEGIN_EXAMPLE + This is an example +#+END_EXAMPLE +``` + +But this will: + +``` +: This is an example +``` + +That was a nice surprise for me, because I prefer org-mode for almost +all of my documents. + + + + diff --git a/rlwrapping_sbcl.post b/rlwrapping-sbcl.post similarity index 100% rename from rlwrapping_sbcl.post rename to rlwrapping-sbcl.post