Files
org_roam/Emacs/20250326002128-emacs_stuff_elisp.org
Zaine a1da976cc6
All checks were successful
Build Roam Site / build (push) Successful in 29s
perms fix
2026-05-06 15:52:11 +01:00

83 lines
1.7 KiB
Org Mode
Executable File

:PROPERTIES:
:ID: 7e79e4c5-383d-450f-882c-33d4f87ba1b5
:END:
#+title: Emacs ELISP
#+filetags: :emacs:elisp:guide:
-- use `<s` followed by `TAB`
#+BEGIN_SRC elisp
(defun my-echo-input ()
"Prompt the user for input and echo it back."
(interactive)
(message "hello"))
#+END_SRC
#+RESULTS:
: my-echo-input
#+begin_src emacs-lisp
(shell-command "thunar ~/Documents/ &")
(run-at-time "1 sec" nil #'delete-other-windows)
#+end_src
#+RESULTS:
: [nil 26600 20298 876807 nil delete-other-windows nil nil 917000 nil]
#+begin_src 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 " "."))))
)
#+end_src
#+RESULTS:
: open-current-dir
#+begin_src 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)
#+end_src
#+begin_src 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)))
#+end_src
#+RESULTS:
: test