동적 버퍼 목차로 두 번째 버퍼에서 조직 모드 개요를 얻으려면 어떻게해야합니까? / (또는 실제 지점)을 클릭

큰 문서를 편집 할 때 별도의 버퍼에서 개요 (내용 없음)를보고 현재 위치를 확인하고 싶습니다. PDF 파일을 읽을 때와 마찬가지로 왼쪽에 TOC가 있습니다. (아래 참조)

조직 모드에서는 개요를 확장 / 축소 할 수 있습니다. 그러나 제목을 클릭하면 다른 버퍼가 해당 위치로 이동하도록 별도의 버퍼에서 왼쪽 또는 오른쪽에 정적 외곽선을 가질 수 있습니까?

이런 식이지만 org-mode를 좋아합니까?
여기에 이미지 설명을 입력하십시오

[편집]
clone-indirect-buffer매우 가까운 내가 원하는 것입니다. 퍼즐의 누락 부분은 제목 / (또는 실제 지점)을 클릭 할 때 동일한 위치로 점프하는 것입니다.

이를 위해 몇 가지 코드를 작성하려고했습니다. 다른 복제 된 버퍼로 이동하십시오. (간접 버퍼의 동기 위치) (org-mode)

그러나 내용이 축소되면 작동하지 않습니다. 이것이 가능하다면 clone-inderect-buffer는 이것에 대한 완벽한 해결책입니다.

[Edit2 Solution]
위의 링크와 아래 답변의 코드는 niceley를 결합하여 앞뒤로 점프를 해결합니다.

;first call 'clone-indirect-buffer'. Then...

;This function works between buffer and it's clone.
(defun my/goto-same-spot-in-other-buffer ()
  "Go to the same location in the other buffer. Useful for when you have cloned indirect buffers"
  (interactive)
  (let ((my/goto-current-point (point)))
       (other-window 1)
       (goto-char my/goto-current-point)
       (when (invisible-p (point))
        (org-reveal)))
)

;This function is a clone-to-buffer jump only:
; It does find the other buffer first thou instead of just jumping to the other 
; window as does the function above.
(defun my/jump-to-point-and-show ()
  "Switch to a cloned buffer's base buffer and move point to the
cursor position in the clone."
  (interactive)
  (let ((buf (buffer-base-buffer)))
    (unless buf
      (error "You need to be in a cloned buffer!"))
    (let ((pos (point))
          (win (car (get-buffer-window-list buf))))
      (if win
          (select-window win)
        (other-window 1)
        (switch-to-buffer buf))
      (goto-char pos)
      (when (invisible-p (point))
        (show-branches)))))


(global-set-key (kbd "<s-mouse-1>") 'my/goto-same-spot-in-other-buffer)
(global-set-key (kbd "s-m") 'my/goto-same-spot-in-other-buffer)
(global-set-key (kbd "<C-s-mouse-1>") 'my/jump-to-point-and-show)
(global-set-key (kbd "C-s-m") 'my/jump-to-point-and-show)



답변

몇 가지 옵션이 떠 오릅니다. 처음 두 개 speedbar는와 잘 어울리는 것으로 알려져 있으며 org-mode, minimap사용하지는 않았지만 개인적으로 보증 할 수는 없습니다.

가장 간단한 옵션이자 가장 유연한 옵션은 간접 버퍼 를 사용하는 것 입니다.

실제로 org개요를 원하는 버퍼 로 이동하여 M-x clone-indirect-buffer( C-u M-x clone-indirect-buffer클론이 호출되는 것을 제어하려는 경우 사용 ) 누른 다음 붐을 사용하면 사용할 수있는 버퍼 사본이 하나 더 있습니다. 원본 버퍼와 나란히 창이나 프레임에 클론을 넣고 클론에서 취향에 맞게 윤곽선을 조정하십시오.

언급 한 “개요에서 제목을 클릭하십시오”기능을 제공하지는 않지만 사이드 바의 정신을 얻습니다.

편집 : 귀하의 의견에 따라 버퍼 클론 에서 호출 할 때 기본 버퍼로 전환 하고 커서가 버퍼 클론의 어느 위치로든 이동 하는 간단한 명령이 있습니다 .

(defun jump-to-point-and-show ()
  "Switch to a cloned buffer's base buffer and move point to the
cursor position in the clone."
  (interactive)
  (let ((buf (buffer-base-buffer)))
    (unless buf
      (error "You need to be in a cloned buffer!"))
    (let ((pos (point))
          (win (car (get-buffer-window-list buf))))
      (if win
          (select-window win)
        (other-window 1)
        (switch-to-buffer buf))
      (goto-char pos)
      (when (invisible-p (point))
        (show-branches)))))


답변

어떻습니까 : M-x occur RET ^*+ RET(정규 표현식 끝에 공백이 있음에 유의하십시오).


답변

Dan의 답변과 그에 대한 솔루션을 읽은 후에 이것을 정리했습니다. 그것은 새로운 좁혀 읽기 전용 클론을 현재 버퍼의 좌측에, 그리고 결합 열리고 <mouse-1>RET베이스 버퍼에 해당 위치로 이동 클론에 국부적.

(defun my/open-tree-view ()
  "Open a clone of the current buffer to the left, resize it to 30 columns, and bind <mouse-1> to jump to the same position in the base buffer."
  (interactive)
  (let ((new-buffer-name (concat "<tree>" (buffer-name))))
    ;; Create tree buffer
    (split-window-right 30)
    (if (get-buffer new-buffer-name)
        (switch-to-buffer new-buffer-name)  ; Use existing tree buffer
      ;; Make new tree buffer
      (progn  (clone-indirect-buffer new-buffer-name nil t)
              (switch-to-buffer new-buffer-name)
              (read-only-mode)
              (hide-body)
              (toggle-truncate-lines)

              ;; Do this twice in case the point is in a hidden line
              (dotimes (_ 2 (forward-line 0)))

              ;; Map keys
              (use-local-map (copy-keymap outline-mode-map))
              (local-set-key (kbd "q") 'delete-window)
              (mapc (lambda (key) (local-set-key (kbd key) 'my/jump-to-point-and-show))
                    '("<mouse-1>" "RET"))))))

(defun my/jump-to-point-and-show ()
  "Switch to a cloned buffer's base buffer and move point to the cursor position in the clone."
  (interactive)
  (let ((buf (buffer-base-buffer)))
    (unless buf
      (error "You need to be in a cloned buffer!"))
    (let ((pos (point))
          (win (car (get-buffer-window-list buf))))
      (if win
          (select-window win)
        (other-window 1)
        (switch-to-buffer buf))
      (goto-char pos)
      (when (invisible-p (point))
        (show-branches)))))

이와 함께 작동 outline-mode하고 outline-minor-mode,뿐만 아니라 같은 그들에 모드 그 빌드를, org-mode. 로컬 키 맵을 얻는 방법에 대한 정보 를 찾았 지만 복사 할 키를 선택하는 방법을 모르겠습니다. 이 또한의 이 페이지를 자동으로 버퍼 특정 버퍼 로컬 키를 설정하기위한 작은 모드를 만들 수있는 기능을 가지고 있지만, 그 범위 밖 보인다이 문제에 대한.


답변

마지막으로 이것은 패키지에서 구현되었습니다 org-sidebar.

조직 사이드 트리 데모


답변

텍스트 편집기에 aquamacs를 사용하는 비 프로그래머가 제공하는 두 가지 임대료 제안 (내가하는 일) :

  1. 버퍼 내 명령으로 앞뒤로 전환 :

시작 : 들여 쓰기 (폭포 유형 개요를 전체적으로보기 쉽게 표시)

이것은 버퍼를 탭으로 볼 때 사용합니다.

+ OPTIONS : H : N, 여기서 N = = html 내보내기에서 보려는 레벨 수 (제안 # 2)

참조 :
https://emacsclub.github.io/html/org_tutorial.html

  1. TOC를 보려면 html (CC CE hh)로 내보내십시오. 들여 쓰기 할 HTML 또는 텍스트 (CC CE ta)의 텍스트 출력을 쉽게 얻을 수있는 사람을 찾을 수 없습니다.

답변

비슷한 것이 필요했기 때문에 outline-tocmode를 합쳤습니다 . org-mode docs에서 작동합니다.


답변