Skip to content

Instantly share code, notes, and snippets.

@legumbre
Created September 8, 2011 01:55
Show Gist options
  • Select an option

  • Save legumbre/1202418 to your computer and use it in GitHub Desktop.

Select an option

Save legumbre/1202418 to your computer and use it in GitHub Desktop.
flet and byte-compiled primitives
;; discussed this with jlf and turbofail in #emacs
;; say we want a function face-at-pos, and we attempt to do
;; it by fletting `point' and using `face-at-point'
(defun face-at-pos (pos)
"return the face at position p using face-at-point"
(flet ((point () pos))
(face-at-point))) ;; face-at-point uses `point' internally
;; that won't work if face-at-point is byte-compiled since `point' is
;; a bytecode primitive and the interpreter will bypass the symbol
;; lookup (so no flet!)
;; One can see the byte-opcode flag set in (symbol-plist 'point)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment