:PROPERTIES:
:ID:       7e79e4c5-383d-450f-882c-33d4f87ba1b5
:END:
#+title: emacs-stuff-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

