Files
vault/Technical/Emacs/Elisp.md
Zaine 129ce1442b
Some checks failed
Build Quartz Notes / build (push) Failing after 20s
13
2026-07-13 09:16:09 +01:00

64 lines
1.4 KiB
Markdown
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
use `<s` followed by `TAB`
``` elisp
(defun my-echo-input ()
"Prompt the user for input and echo it back."
(interactive)
(message "hello"))
```
``` commonlisp
(shell-command "thunar ~/Documents/ &")
(run-at-time "1 sec" nil #'delete-other-windows)
```
``` elisp
(defun open-current-dir()
(interactive)
(cond ((string-equal system-type "gnu/linux")
(shell-command (concat "thunar " ".")))
((string-equal system-type "darwin")
(shell-command (concat "open " "."))))
)
```
``` elisp
(defun test()
(interactive)
(cond ((string-equal system-type "gnu/linux")
(message "linux"))
((string-equal system-type "darwin")
(message "mac"))
)
)
(defun kill-other-buffers-startup ()
"Kill all buffers except the current one."
(interactive)
(mapc (lambda (buffer)
(unless (eq buffer (current-buffer))
(kill-buffer buffer)))
(buffer-list)))
;(add-hook 'emacs-startup-hook #'kill-other-buffers-startup)
```
``` elisp
(defun create-weekly-entry ()
(interactive)
(let* ((current-date-time-format "[%Y-week-%V]")
(timestamp (format-time-string current-date-time-format))
(entry (concat "* Weekly Entry: " timestamp "\n"
"** Tasks:\n"
"** Notes:\n"
)))
(write-region entry nil "~/master-folder/org_files/todo/master-tl.org" 'append)))
```