Skip to content

Instantly share code, notes, and snippets.

View letoh's full-sized avatar
💭
I may be slow to respond.

letoh letoh

💭
I may be slow to respond.
View GitHub Profile
(let* ((src (read-file-name "Source: "))
(dst (read-file-name (concat src " -> "))))
(concat src " -> " dst))
@letoh
letoh / creation-prompt.el
Last active May 30, 2023 07:32
Examples for using auth-source api in Emacs
(let ((auth-source-creation-prompts
'((secret . "password for %u: ")))
(info ...))
...)
(let* ((options '("aaa" "bbb" "ccc"))
(ans (dropdown-list options)))
(print (format "you choose: %s" (nth ans options))))
@letoh
letoh / gist:5459643
Created April 25, 2013 13:23
lexical binding in elisp
(require 'cl)
(defun make-greeter (greeting-prefix)
(lexical-let ((greeting-prefix greeting-prefix))
(lambda (username) (concat greeting-prefix ", " username))))
(let ((f (make-greeter "hello")))
(funcall f "world"))
(funcall (make-greeter "hello") "world")
;;
;; ( f -- ) _if <then_label>
;; do something
;; then_label:
;;
%macro _if 1
cell _0branch
dd %1-%%_offset
%%_offset:
%endmacro
void vm_exec_xt(vm_t *vm, xt_t *xt)
{
...
CODE(COLON):
/* ( C: "<spaces>name" -- colon-sys ) */
{
char *token = tib_getToken(vm->tib, vm->src, " \n\t\r");
word_t *w = dict_addword(vm->dict, token, ATTR_HIDDEN, (xt_t)&&F_ENTER);
%gen_inp
%ename changjei
%cname 倉頡
%selkey 1234567890
%space_style 4
# %keep_key_case
%keyname begin
a 日
b 月
c 金
#!/usr/bin/env python
def outer():
times_called = 0
def inner():
print "called", times_called, "times"
return inner
f = outer()
f()
## Header to ignore
source ~/.mutt/ignore
## Keybindings
source ~/.mutt/keybind
## Color
source ~/.mutt/color
## GnuPG
#!/usr/bin/python
import pygame
from pygame import mixer as mixer
import sys
if len(sys.argv) == 1:
sys.exit()
try:
pygame.init()