about summary refs log tree commit diff stats
path: root/content
diff options
context:
space:
mode:
authorAlan Pearce2018-06-07 13:55:17 +0200
committerAlan Pearce2018-06-07 13:55:17 +0200
commit10dded485e1c2627575b2b9e21dfaabc31ee07f3 (patch)
treeb3f0369bae776cd556078225fc446c10165f8624 /content
parent956bf3a40be61da586bd5178a3868ca037eebbe8 (diff)
downloadwebsite-10dded485e1c2627575b2b9e21dfaabc31ee07f3.tar.lz
website-10dded485e1c2627575b2b9e21dfaabc31ee07f3.tar.zst
website-10dded485e1c2627575b2b9e21dfaabc31ee07f3.zip
Use code fences instead of template tags for syntax highlighting
Diffstat (limited to 'content')
-rw-r--r--content/post/cedit-and-paredit.md4
-rw-r--r--content/post/emacs-package-archive-statistics.md40
-rw-r--r--content/post/opening-projects-with-projectile.md20
-rw-r--r--content/post/repository-management-with-ghq.md16
-rw-r--r--content/post/self-hosted-git.md29
5 files changed, 54 insertions, 55 deletions
diff --git a/content/post/cedit-and-paredit.md b/content/post/cedit-and-paredit.md
index a8b65a1..23fb1c4 100644
--- a/content/post/cedit-and-paredit.md
+++ b/content/post/cedit-and-paredit.md
@@ -28,12 +28,12 @@ paredit.  Turns out it provides
 that control whether a space should be inserted.  So, solving the
 formatting issue turned out to be pretty simple:
 
-{{< highlight cl >}}
+```elisp
 (defun ap/cedit-space-delimiter-p (endp delimiter)
 "Don't insert a space before delimiters in c-style modes"
 (not cedit-mode))
 (add-to-list 'paredit-space-for-delimiter-predicates #'ap/cedit-space-delimiter-p)
-{{< /highlight >}}
+```
 
 Hopefully that saves someone some time if they try to use the two
 together.
diff --git a/content/post/emacs-package-archive-statistics.md b/content/post/emacs-package-archive-statistics.md
index 5f74f18..2275c9a 100644
--- a/content/post/emacs-package-archive-statistics.md
+++ b/content/post/emacs-package-archive-statistics.md
@@ -10,13 +10,13 @@ I use [cask][] for managing the dependencies of my Emacs
 configuration.  Whenever I opened my `Cask` file, I wondered if I
 really was using all the sources I had defined:
 
-{{< highlight cl >}}
+```elisp
 (source gnu)
 (source marmalade)
 (source melpa)
 (source melpa-stable)
 (source org)
-{{< /highlight >}}
+```
 
 It seemed quite strange that we have so many package repositories in
 the Emacs world and I'm not even using all of them.  I find this state
@@ -44,29 +44,29 @@ decided to try to figure out how to generate some usage statistics.
 I found [how to get a list of installed packages][], but that just gives
 a list:
 
-{{< highlight cl >}}
+```elisp
 (ace-jump-mode ag auto-compile auto-indent-mode autopair ...)
-{{< /highlight >}}
+```
 
 I needed to get more information about those packages.  I looked at
 where `list-packages` gets that information from.  It seems that
 `package-archive-contents` is a list of cons cells:
 
-{{< highlight cl >}}
+```elisp
 (org-plus-contrib .
 				  [(20140714)
 				  nil "Outline-based notes management and organizer" tar "org"])
-{{< /highlight >}}
+```
 
 Then created a function to loop over the contents of
 `package-activated-list`, retrieving the corresponding contents of
 `package-archive-contents`:
 
-{{< highlight cl >}}
+```elisp
 (defun package-list-installed ()
   (loop for pkg in package-activated-list
         collect (assq pkg package-archive-contents)))
-{{< /highlight >}}
+```
 
 This generates a list of arrays from `package-archive-contents`.
 There are some helper functions in package.el such as
@@ -74,11 +74,11 @@ There are some helper functions in package.el such as
 needed.  I happened to be using a pretest version of Emacs at the time
 and didn't know that it's not in 24.3, so I just made sure it was defined:
 
-{{< highlight cl >}}
+```elisp
 (if (not (fboundp #'package-desc-archive))
     (defsubst package-desc-archive (desc)
       (aref desc (1- (length desc)))))
-{{< /highlight >}}
+```
 
 Weirdly, some of the arrays (seemingly the ones from the
 [org archive][]) had a different length, but the repository/archive was
@@ -89,7 +89,7 @@ To generate a list of statistics, I just needed to loop over the
 installed packages from `package-list-installed` and update a count
 for each archive:
 
-{{< highlight cl >}}
+```elisp
 (defun package-archive-stats ()
   (let ((archives (makehash))
         (assoc '()))
@@ -101,32 +101,32 @@ for each archive:
                (let ((pkg-arc (package-desc-archive (cdr pkg))))
                  (incf (gethash pkg-arc archives)))))
     assoc))
-{{< /highlight >}}
+```
 
 Running this gives a list of cons cells:
 
-{{< highlight cl >}}
+```elisp
 (("gnu" . 0)
  ("org" . 1)
  ("melpa-stable" . 2)
  ("melpa" . 106)
  ("marmalade" . 1))
-{{< /highlight >}}
+```
 
 I wrapped it in an interactive function so that I could check the
 numbers quickly:
 
-{{< highlight cl >}}
+```elisp
 (defun package-show-archive-stats ()
   (interactive)
   (message "%s" (package-archive-stats)))
-{{< /highlight >}}
+```
 
 With that, I removed `(source gnu)` from my `Cask` file.  Now I had
 another question.  What package was installed from [marmalade][]?  In
 the lisp fashion, I created yet another function:
 
-{{< highlight cl >}}
+```elisp
 (defun package-show-installed-from-archive (archive)
   (interactive (list (helm-comp-read "Archive: " (mapcar #'car package-archives)
                                       :must-match t)))
@@ -136,15 +136,15 @@ the lisp fashion, I created yet another function:
     (if (called-interactively-p)
         (message "%s" from-arc)
       from-arc)))
-{{< /highlight >}}
+```
 (Non-helm users can replace `helm-comp-read` with
 `ido-completing-read` or similar)
 
 Running this with the argument `"marmalade"` gives:
 
-{{< highlight cl >}}
+```elisp
 (php-extras)
-{{< /highlight >}}
+```
 
 I checked on [MELPA Stable][] and [MELPA][], but it's not available
 there.  Given that I use [php-extras][] quite a bit at work, I can't remove
diff --git a/content/post/opening-projects-with-projectile.md b/content/post/opening-projects-with-projectile.md
index 04f8cb6..d88d309 100644
--- a/content/post/opening-projects-with-projectile.md
+++ b/content/post/opening-projects-with-projectile.md
@@ -12,30 +12,30 @@ With this in mind, I decided to try to add support for opening projects under a
 
 I saw that projectile uses [Dash.el][] in some places, and after reading about [anaphoric macros], I decided that I'd try to use them to aid me.
 
-{{% highlight cl %}}
+```elisp
 (defun ap/subfolder-projects (dir)
   (--map (file-relative-name it dir)
          (-filter (lambda (subdir)
                     (--reduce-from (or acc (funcall it subdir)) nil
                                    projectile-project-root-files-functions))
                   (-filter #'file-directory-p (directory-files dir t "\\<")))))
-{{% /highlight %}}
+```
 
 First, this filters the non-special files under `dir`, filtering non-directories.  Then it runs the list of `projectile-project-root-files-functions` on it to determine if it looks like a projectile project.  To make the list more readable, it makes the filenames relative to the passed-in directory.  It runs like this:
                   
-{{% highlight cl %}}
+```elisp
 (ap/subfolder-projects "~/projects") =>
 ("dotfiles" "ggtags" …)
-{{% /highlight %}}
+```
 
 So, we've got ourselves a list, but now we need to be able to open the project that's there, even though the folders are relative.
 
-{{% highlight cl %}}
+```elisp
 (defun ap/open-subfolder-project (from-dir &optional arg)
   (let ((project-dir (projectile-completing-read "Open project: "
                                      (ap/subfolder-projects from-dir))))
     (projectile-switch-project-by-name (expand-file-name project-dir from-dir) arg)))
-{{% /highlight %}}
+```
 
 By wrapping the call to `ap/subfolder-projects` in another function that takes the same directory argument, we can re-use the project parent directory and expand the selected project name into an absolute path before passing it to `projectile-switch-project-by-name`.
 
@@ -43,7 +43,7 @@ We get support for multiple completion systems for free, since projectile has a
 
 Then I defined some helper functions to make it easy to open work and home projects.
 
-{{% highlight cl %}}
+```elisp
 (defvar work-project-directory "~/work")
 (defvar home-project-directory "~/projects")
 
@@ -54,7 +54,7 @@ Then I defined some helper functions to make it easy to open work and home proje
 (defun ap/open-home-project (&optional arg)
   (interactive "P")
   (ap/open-subfolder-project home-project-directory arg))
-{{% /highlight %}}
+```
 
 I could probably simplify this with a macro, but I'm not sure that there's much advantage in it.  I only have two project types right now, after all.
 
@@ -62,14 +62,14 @@ With this all set up, whenever I want to start working on a project I just type
 
 I also considered trying to add all the projects under a directory to the projectile known project list.  I didn't find it quite as easy to use, but it's available below if anyone would prefer that style.
 
-{{% highlight cl %}}
+```elisp
 (defun ap/-add-known-subfolder-projects (dir)
   (-map #'projectile-add-known-project (--map (concat (file-name-as-directory dir) it) (ap/subfolder-projects dir))))
 
 (defun ap/add-known-subfolder-projects ()
   (interactive)
   (ap/-add-known-subfolder-projects (ido-read-directory-name "Add projects under: ")))
-{{% /highlight %}}
+```
 
 [Projectile]: https://github.com/bbatsov/projectile
 [Dash.el]: https://github.com/magnars/dash.el
diff --git a/content/post/repository-management-with-ghq.md b/content/post/repository-management-with-ghq.md
index 6006605..d831c9e 100644
--- a/content/post/repository-management-with-ghq.md
+++ b/content/post/repository-management-with-ghq.md
@@ -8,10 +8,10 @@ I recently encountered [ghq][], a tool for automatically organising VCS-backed
 projects automatically.  Give it a repository URL, it will clone a project to
 your projects dir (set by `$GHQ_ROOT`) like so:
 
-{{< highlight sh >}}
+```sh
 $ ghq get https://github.com/motemen/ghq
 # Runs `git clone https://github.com/motemen/ghq ~/.ghq/github.com/motemen/ghq`
-{{< /highlight >}}
+```
 
 I don't like the idea of having projects hidden away, so I set
 `$GHQ_ROOT` to `$HOME/projects`.
@@ -23,11 +23,11 @@ I wanted a nicer way to visit project directories.  Since I'm
 using [fzf][] as a fuzzy-finder, I thought it would be nice to use it
 for this.  I created a simple function, `fp` (find project) to do that:
 
-{{< highlight sh >}}
+```sh
 fp () {
   ghq look $(ghq list | fzf +m)
 }
-{{< /highlight >}}
+```
 
 I ran into some issues with the subshell of `ghq look` and wondered
 whether it might be possible to create a zsh command to remove the
@@ -36,7 +36,7 @@ need for a subshell.
 I found that `fzf` includes a [cd-widget function][fzf-cd-widget] and created
 something similar that uses `ghq` instead of `find`:
 
-{{< highlight sh >}}
+```sh
 cd-project-widget () {
   local cmd="ghq list"
   setopt localoptions pipefail 2> /dev/null
@@ -52,7 +52,7 @@ cd-project-widget () {
   return $ret
 }
 zle -N cd-project-widget
-{{< /highlight >}}
+```
 
 It should be quite simple to modify it to work with other
 fuzzy-finders.  The basic idea is to show the output of `ghq list` for
@@ -62,9 +62,9 @@ to print the correct directory for `cd`.
 What's really nice about this, is that I can bind it to a key
 sequence:
 
-{{< highlight sh >}}
+```sh
 bindkey '\es' cd-project-widget
-{{< /highlight >}}
+```
 
 Now I can press `M-s` in a shell, start typing "dotfiles" and press enter to `cd`
 to my [dotfiles][] project. Pretty neat!
diff --git a/content/post/self-hosted-git.md b/content/post/self-hosted-git.md
index c73d255..883ea0f 100644
--- a/content/post/self-hosted-git.md
+++ b/content/post/self-hosted-git.md
@@ -62,22 +62,22 @@ means that I can create a remote repository automatically by cloning a
 repository URL that doesn't already exist.
 I can clone and create a new repo simultaneously like so:
 
-{{< highlight shell-session >}}
+```shell
 cd ~/projects
 git clone alanpearce.eu:some-new-repository
-{{< /highlight >}}
+```
 
 But with [ghq][], which I [blogged about before][using-ghq], I don't
 have to concern myself with where to put the repository:
 
-{{< highlight shell-session >}}
+```shell
 $ ghq get alanpearce.eu:some-new-repository
      clone ssh://alanpearce.eu/some-new-repository -> /Volumes/Code/projects/alanpearce.eu/some-new-repository
        git clone ssh://alanpearce.eu/some-new-repository /Volumes/Code/projects/alanpearce.eu/some-new-repository
 Cloning into '/Volumes/Code/projects/alanpearce.eu/some-new-repository'...
 Initialized empty Git repository in /var/lib/gitolite/repositories/some-new-repository.git/
 warning: You appear to have cloned an empty repository.
-{{< /highlight >}}
+```
 
 The nice URLs come from this piece of my SSH configuration:
 
@@ -92,10 +92,10 @@ Host alanpearce.eu
 This repository would be private by default, but I can change that by an
 SSH command.  Here's how I would do it:
 
-{{< highlight shell-session >}}
-$ ssh alanpearce.eu perms some-new-repository + READERS gitweb
-$ ssh alanpearce.eu perms some-new-repository + READERS daemon
-{{< /highlight >}}
+```shell
+ssh alanpearce.eu perms some-new-repository + READERS gitweb
+ssh alanpearce.eu perms some-new-repository + READERS daemon
+```
 
 The first command makes it visible in cgit, whilst the second makes it
 clonable via `git://` url.  I can make a repository
@@ -105,15 +105,14 @@ user and not `gitweb`, if I wanted.
 I can also add or change the description of a repository shown on cgit like
 so:
 
-{{< highlight shell-session >}}
-$ ssh alanpearce.eu desc some-new-repository 'A new repository'
-{{< /highlight >}}
+```shell
+ssh alanpearce.eu desc some-new-repository 'A new repository'
+```
 
 All the remote commands exposed by gitolite are described in the
-`help` command
+`help` command e.g. `ssh alanpearce.eu help`
 
-{{< highlight shell-session >}}
-$ ssh alanpearce.eu help
+```
 hello alan, this is gitolite@oak running gitolite3 (unknown) on git 2.12.2
 
 list of remote commands available:
@@ -126,7 +125,7 @@ list of remote commands available:
 	perms
 	writable
 
-{{< /highlight >}}
+```
 
 ## Conclusion