test.el 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. (setq the-layer
  2. (make-buffer-layer
  3. :name 'org
  4. :files '("~/org/"
  5. "~/org/agenda.org"
  6. "~/org/bookmarks.org"
  7. "~/org/college.org"
  8. "~/org/index.org"
  9. "~/org/personal-log.org"
  10. "~/org/quotes.org"
  11. "~/org/recipes.org"
  12. "~/org/school.org"
  13. "~/org/snips.org"
  14. "~/org/travel-list.org"
  15. "~/org/main.org")
  16. :select "main.org"
  17. :on-apply (lambda ()
  18. (my/find-current-notes-file))
  19. :on-apply-source '((my/find-current-notes-file))))
  20. (insert (format "%S\n\n" (let ((name (buffer-layer-name the-layer))
  21. (files (buffer-layer-files the-layer))
  22. (select (buffer-layer-select the-layer))
  23. (on-apply (buffer-layer-on-apply-source the-layer))
  24. (on-remove (buffer-layer-on-remove-source the-layer)))
  25. `(define-buffer-layer* ,name
  26. :files ,files
  27. :select ,select
  28. :on-apply ,on-apply
  29. :on-remove ,on-remove))))
  30. (define-buffer-layer org
  31. :files ("~/org/"
  32. "~/org/agenda.org"
  33. "~/org/bookmarks.org"
  34. "~/org/college.org"
  35. "~/org/index.org"
  36. "~/org/personal-log.org"
  37. "~/org/quotes.org"
  38. "~/org/recipes.org"
  39. "~/org/school.org"
  40. "~/org/snips.org"
  41. "~/org/travel-list.org"
  42. "~/org/main.org")
  43. :select "main.org"
  44. :on-apply ((my/find-current-notes-file)))
  45. *buffer-layer-definitions*
  46. (define-buffer-layer org
  47. :files ("~/org/"
  48. "~/org/agenda.org"
  49. "~/org/bookmarks.org"
  50. "~/org/college.org"
  51. "~/org/index.org"
  52. "~/org/personal-log.org"
  53. "~/org/quotes.org"
  54. "~/org/recipes.org"
  55. "~/org/school.org"
  56. "~/org/snips.org"
  57. "~/org/travel-list.org"
  58. "~/org/main.org")
  59. :select "main.org"
  60. :on-apply ((my/find-current-notes-file)))
  61. (buffer-layer--get-buffer-layer-definition 'org)
  62. (defun my/find-current-notes-file ())