BIBLIOGRAPHY
History
DONE 조직모드에서 왜 filestags가 알파벳 순으로 정렬이 되는 것인가? 설정을 변경하는 방법을 찾아줘
요약:
filestags가 알파벳 순으로 정렬되는 것은 org-mode의 기본 동작이며, org-tags-sort-function 변수를 통해 정렬 방식을 자유롭게 변경할 수 있습니다. 입력 순서 유지, 특정 태그 우선 정렬 등 원하는 방식으로 커스터마이즈가 가능합니다
왜 org-mode에서 filestags가 알파벳 순으로 정렬되는가?
- org-mode는 기본적으로 태그를 알파벳 순으로 정렬합니다. 이는 태그의 일관성과 검색 편의성을 위해 설계된 기본 동작입니다. 태그를 입력하거나 수정할 때, 내부적으로 `org-tags-sort-function` 변수를 사용하여 태그 리스트를 정렬합니다. 이 변수의 기본값은 알파벳 정렬 함수(`string<`)로 설정되어 있습니다[6][2].
filestags 정렬 방식을 변경하는 방법
-
태그 정렬 방식을 바꾸고 싶다면, `org-tags-sort-function` 변수를 원하는 정렬 함수로 설정하면 됩니다. 예를 들어, 태그를 역순으로 정렬하고 싶다면 다음과 같이 설정할 수 있습니다.
(setq org-tags-sort-function #'org-string-collate-greaterp)또는, 커스텀 정렬 함수를 직접 정의해서 사용할 수도 있습니다. 예를 들어, 특정 태그(`event`)를 항상 맨 앞으로 오게 하고 나머지는 알파벳 순으로 정렬하려면 다음과 같이 할 수 있습니다[2]:
(defun my/org-custom-tags-sort (a b) (cond ((string= a "event") t) ((string= b "event") nil) (t (string< a b)))) (setq org-tags-sort-function #'my/org-custom-tags-sort) -
태그를 수동으로 정렬하고 싶을 때는, 헤딩 위에서 다음 함수를 실행할 수도 있습니다[6]:
(defun my/org-sort-tags () "헤딩의 태그를 정렬합니다." (interactive) (when (org-at-heading-p) (org-set-tags (sort (org-get-tags) #'string<))))
참고
- 위 설정은 파일 전체에 적용되며, org-mode에서 태그를 입력하거나 수정할 때마다 적용됩니다.
- agenda에서의 정렬은 별도의 변수(`org-agenda-sorting-strategy`)로 제어합니다[5].
정리 org-mode에서 filestags가 알파벳 순으로 정렬되는 것은 `org-tags-sort-function`의 기본값 때문입니다. 이 변수를 원하는 정렬 함수로 변경하면 filestags의 정렬 방식을 자유롭게 바꿀 수 있습니다[6][2].
Citations: [1] https://emacs.stackexchange.com/questions/7541/sorting-headings-in-an-org-file [2] https://stackoverflow.com/questions/18201311/how-to-custom-sort-tags-using-org-tags-sort-function-with-org-set-tags [3] https://github.com/yantar92/org-autosort [4] https://www.reddit.com/r/orgmode/comments/o2df99/automatically_recursively_sorting_an_org_file/ [5] https://www.reddit.com/r/emacs/comments/iyw1y9/orgmode_how_do_i_display_items_with_specific/ [6] https://emacs.dyerdwelling.family/emacs/20230406210733-emacs—more-sorting-tags-options/ [7] https://stackoverflow.com/questions/22231431/sort-a-mixed-list-of-headings-in-org-mode [8] https://orgmode.org/manual/Sorting-of-agenda-items.html [9] https://orgmode.org/worg/org-tutorials/advanced-searching.html [10] https://emacs.stackexchange.com/questions/16317/sorting-org-mode-org-agenda-file [11] https://news.ycombinator.com/item?id=37086176 [12] https://www.gnu.org/software/emacs/manual/html_node/org/Presentation-and-Sorting.html [13] https://orgmode.org/manual/Presentation-and-Sorting.html [14] https://appsonthemove.freshdesk.com/support/discussions/topics/14000019684/page/last [15] https://orgmode.org/org.html [16] https://orgmode.org/manual/In_002dbuffer-Settings.html [17] https://help-gnu-emacs.gnu.narkive.com/BVgjnCEh/sorting-headers-alphabetically-in-org-mode [18] https://support.hogbaysoftware.com/t/filter-by-date-then-sort-by-tag/3771 [19] https://superuser.com/questions/611527/org-sort-multi-date-time-d-t-priority-p-title-a [20] https://github.com/kristijanhusak/orgmode.nvim/issues/128 [21] https://superuser.com/questions/354209/how-do-i-sort-or-move-done-items-in-org-mode [22] https://orgmode.org/worg/org-configs/org-customization-guide.html [23] https://emacs-orgmode.gnu.narkive.com/e7GF61Yx/orgmode-getting-org-agenda-sorting-strategy-to-work [24] https://orgmode.org/worg/org-tutorials/org-custom-agenda-commands.html [25] https://orgmode.org/manual/Categories.html [26] https://orgmode.org/orgguide.html [27] https://www.reddit.com/r/emacs/comments/iyw1y9/orgmode_how_do_i_display_items_with_specific/ [28] https://emacs.stackexchange.com/questions/7541/sorting-headings-in-an-org-file [29] https://orgmode.org/manual/Setting-options.html [30] https://www.gnu.org/software/emacs/manual/html_node/org/Setting-Tags.html
--- Perplexity로부터의 답변: pplx.ai/share
Comments