Skip to content

Instantly share code, notes, and snippets.

(defun wes:c-lineup-continuation (langelem)
(save-excursion
(let ((indent-point (cdr langelem)))
(goto-char indent-point)
(beginning-of-line nil)
(skip-chars-forward " \t")
(vector (+ (/ c-basic-offset 2) (current-column))))))
(c-add-style "sun"
'((c-basic-offset . 8)
#!/bin/bash
eflag=
while getopts e opt; do
case $opt in
e) eflag=1;;
\?) printf "Usage: pargs [-e] <pid> ...]"; exit 2;;
esac
done
@richlowe
richlowe / emoji.el
Last active February 11, 2016 21:19
(defvar emoji-font
(case window-system
(ns "Apple Color Emoji")
(w32 "Segoe UI") ;Maybe?
(x "Symbola")) ;Maybe?
"Font used to display emoji")
(defun generate-emoji-font-tables ()
"Fetch the emoji unicode data from unicode.org, and insert
#!/bin/bash
eflag=
while getopts e opt; do
case $opt in
e) eflag=1;;
\?) printf "Usage: pargs [-e] <pid> ...]"; exit 2;;
esac
done
@richlowe
richlowe / keybase.md
Last active August 29, 2015 14:07
keybase.md

Keybase proof

I hereby claim:

  • I am richlowe on github.
  • I am richlowe (https://keybase.io/richlowe) on keybase.
  • I have a public key whose fingerprint is 44B4 DBCC D536 A995 B4BE EF1C 1E28 0D1C 29AC F220

To claim this, I am signing this object:

@richlowe
richlowe / il.el
Last active August 29, 2015 14:01
(defun il--break-lines (pattern)
"Break the buffer such that each PATTERN is at the beginning of a line"
(save-excursion
(goto-char (point-min))
(while (search-forward-regexp pattern nil t)
(goto-char (match-beginning 0))
(unless (bolp)
(insert "\n"))
(goto-char (match-end 0)))))
diff --git a/diffcore.h b/diffcore.h
index 79de8cf..7c6f391 100644
--- a/diffcore.h
+++ b/diffcore.h
@@ -46,7 +46,7 @@ struct diff_filespec {
unsigned is_stdin : 1;
unsigned has_more_entries : 1; /* only appear in combined diff */
/* data should be considered "binary"; -1 means "don't know yet" */
- int is_binary : 2;
+ signed int is_binary : 2;
(defun diff-line-info-as-kill (&optional prefix)
"Copy a chunk of text with the file and line number of the diff line at point.
If the diff line is a deletion, this will be the path and line
number from the old file with (old) appended, otherwise the path
and line number of the new file.
With a prefix argument, remove that meaning leading elements from
the path. The default is 1 (since that's mostly commonly
desired)."
@richlowe
richlowe / gist:4271200
Created December 12, 2012 20:19
mapfile v2 colouring
(define-generic-mode mapfile-mode
'(?#)
'("CAPABILITY" "DEPEND_VERSIONS" "HDR_NOALLOC" "LOAD_SEGMENT"
"NOTE_SEGMENT" "NULL_SEGMENT" "PHDR_ADD_NULL" "SEGMENT_ORDER"
"STACK" "SYMBOL_SCOPE" "SYMBOL_VERSION" "STUB_OBJECT")
`(("^\$[^\s-]+" 0 font-lock-preprocessor-face)
("\\<SYMBOL_VERSION\\s-+\\<\\([A-Za-z0-9_.]+\\)\\>"
1 font-lock-function-name-face)
;; visibility
("\\<\\(global\\|local\\|protected\\|default\\|hidden\\|symbolic\\):" 0
(defun maybe-squash-sccs-keywords ()
"If the current buffer contains SCCS keywords, ask the user whether they should be deleted.
This is designed to be in `write-file-functions'.
If the prompt is answered affirmatively, the line containing the
keywords is deleted, whitespace is compressed, point is left in
the gap and the save is aborted. Otherwise the buffer is saved
as usual."
(interactive)