Skip to content

Instantly share code, notes, and snippets.

@richlowe
richlowe / csgrep.sh
Last active May 5, 2019 22:18
csgrep: Search cscope and provide output similar enough to grep for M-x grep, :grep, etc.
#!/bin/bash
if [[ ! -f cscope.out ]]; then
print -u2 "No cscope.out"
exit 1
fi
# Common to all versions
modes[0]="symbol"; SYMBOL=0
modes[1]="definition of"; DEFINITION=1
(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
(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)
@richlowe
richlowe / rofflmao.py
Created February 27, 2011 03:37
roff(1) Line Mangler And Organizer
#!/usr/bin/env python
# roff(1) Line Mangler And Organizer
#
# Reflow a roff (source) document without damaging it:
#
# - Comments are left intact
# - Commands are left intact
# - Known "Verbatim blocks" are left intact
# - tbl(1) Tables
@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: