diff options
Diffstat (limited to 'content/post')
-rw-r--r-- | content/post/cedit-and-paredit.md | 2 | ||||
-rw-r--r-- | content/post/emacs-package-archive-statistics.md | 20 | ||||
-rw-r--r-- | content/post/opening-projects-with-projectile.md | 10 | ||||
-rw-r--r-- | content/post/postfix-as-null-client-with-external-catchall.md | 4 | ||||
-rw-r--r-- | content/post/self-hosted-git.md | 8 |
5 files changed, 22 insertions, 22 deletions
diff --git a/content/post/cedit-and-paredit.md b/content/post/cedit-and-paredit.md index cd395e9..89f8cb3 100644 --- a/content/post/cedit-and-paredit.md +++ b/content/post/cedit-and-paredit.md @@ -28,7 +28,7 @@ paredit. Turns out it provides that control whether a space should be inserted. So, solving the formatting issue turned out to be pretty simple: -```elisp +```lisp (defun ap/cedit-space-delimiter-p (endp delimiter) "Don't insert a space before delimiters in c-style modes" (not cedit-mode)) diff --git a/content/post/emacs-package-archive-statistics.md b/content/post/emacs-package-archive-statistics.md index 9a8e8bf..43d0969 100644 --- a/content/post/emacs-package-archive-statistics.md +++ b/content/post/emacs-package-archive-statistics.md @@ -10,7 +10,7 @@ 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: -```elisp +```lisp (source gnu) (source marmalade) (source melpa) @@ -44,7 +44,7 @@ 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: -```elisp +```lisp (ace-jump-mode ag auto-compile auto-indent-mode autopair ...) ``` @@ -52,7 +52,7 @@ 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: -```elisp +```lisp (org-plus-contrib . [(20140714) nil "Outline-based notes management and organizer" tar "org"]) @@ -62,7 +62,7 @@ Then created a function to loop over the contents of `package-activated-list`, retrieving the corresponding contents of `package-archive-contents`: -```elisp +```lisp (defun package-list-installed () (loop for pkg in package-activated-list collect (assq pkg package-archive-contents))) @@ -74,7 +74,7 @@ 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: -```elisp +```lisp (if (not (fboundp #'package-desc-archive)) (defsubst package-desc-archive (desc) (aref desc (1- (length desc))))) @@ -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: -```elisp +```lisp (defun package-archive-stats () (let ((archives (makehash)) (assoc '())) @@ -105,7 +105,7 @@ for each archive: Running this gives a list of cons cells: -```elisp +```lisp (("gnu" . 0) ("org" . 1) ("melpa-stable" . 2) @@ -116,7 +116,7 @@ Running this gives a list of cons cells: I wrapped it in an interactive function so that I could check the numbers quickly: -```elisp +```lisp (defun package-show-archive-stats () (interactive) (message "%s" (package-archive-stats))) @@ -126,7 +126,7 @@ 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: -```elisp +```lisp (defun package-show-installed-from-archive (archive) (interactive (list (helm-comp-read "Archive: " (mapcar #'car package-archives) :must-match t))) @@ -142,7 +142,7 @@ the lisp fashion, I created yet another function: Running this with the argument `"marmalade"` gives: -```elisp +```lisp (php-extras) ``` diff --git a/content/post/opening-projects-with-projectile.md b/content/post/opening-projects-with-projectile.md index 775e2be..b44c5e8 100644 --- a/content/post/opening-projects-with-projectile.md +++ b/content/post/opening-projects-with-projectile.md @@ -12,7 +12,7 @@ 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. -```elisp +```lisp (defun ap/subfolder-projects (dir) (--map (file-relative-name it dir) (-filter (lambda (subdir) @@ -23,14 +23,14 @@ I saw that projectile uses [Dash.el][] in some places, and after reading about [ 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: -```elisp +```lisp (ap/subfolder-projects "~/projects") => ("dotfiles" "ggtags" …) ``` 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. -```elisp +```lisp (defun ap/open-subfolder-project (from-dir &optional arg) (let ((project-dir (projectile-completing-read "Open project: " (ap/subfolder-projects from-dir)))) @@ -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. -```elisp +```lisp (defvar work-project-directory "~/work") (defvar home-project-directory "~/projects") @@ -62,7 +62,7 @@ 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. -```elisp +```lisp (defun ap/-add-known-subfolder-projects (dir) (-map #'projectile-add-known-project (--map (concat (file-name-as-directory dir) it) (ap/subfolder-projects dir)))) diff --git a/content/post/postfix-as-null-client-with-external-catchall.md b/content/post/postfix-as-null-client-with-external-catchall.md index 4a604b5..eb0a913 100644 --- a/content/post/postfix-as-null-client-with-external-catchall.md +++ b/content/post/postfix-as-null-client-with-external-catchall.md @@ -11,7 +11,7 @@ It took me a while to figure out how to this, so I thought I'd share my method. Here's the config that can be used to do this on any NixOS host, after redefining the first two variables. -```txt {linenos=table,hl_lines=["2-3"]} +```txt,linenos,hl_lines=2-3 services.postfix = let localUser = "example-user"; forwardingAddress = "user@external.domain"; @@ -36,7 +36,7 @@ Emails to any user without a domain part are all sent to the forwarding address First, the basic setup for a null client can be found in the [postfix documentation][0]. The example config would be translated into NixOS like so: -```txt {linenos=table} +```txt services.postfix = { enable = true; destination = []; diff --git a/content/post/self-hosted-git.md b/content/post/self-hosted-git.md index 1cceff3..3bdbffb 100644 --- a/content/post/self-hosted-git.md +++ b/content/post/self-hosted-git.md @@ -63,7 +63,7 @@ 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: -```shell +```bash cd ~/projects git clone alanpearce.eu:some-new-repository ``` @@ -71,7 +71,7 @@ git clone alanpearce.eu:some-new-repository But with [ghq][], which I [blogged about before][using-ghq], I don't have to concern myself with where to put the repository: -```shell +```bash $ 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 @@ -93,7 +93,7 @@ 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: -```shell +```bash ssh alanpearce.eu perms some-new-repository + READERS gitweb ssh alanpearce.eu perms some-new-repository + READERS daemon ``` @@ -106,7 +106,7 @@ user and not `gitweb`, if I wanted. I can also add or change the description of a repository shown on cgit like so: -```shell +```bash ssh alanpearce.eu desc some-new-repository 'A new repository' ``` |