2011-09-03 3 views
3

최근에 org-annotate-file을 발견했습니다. 필자는 컴퓨터에서 pdf 문서 나 음악 파일 또는 다른 파일에 주석을 달고 annotations.org 파일에 주석을 작성하고 싶습니다. 나는 pdf에 주석을 포함시키고 싶지 않다. 그러나 내가 알 수없는 것은 "파일을 방문하는 것"이 ​​무엇을 의미합니까? 이맥스가 열 수있는 파일이어야합니까?org-annotate-file을 사용하는 방법?

하지만 좀 더 일반적으로 다음과 같은 작업을 수행 할 수있는 패키지가 있습니다. dired 모드에서 디렉토리를 방문하고 관심있는 항목에 파일을 표시 한 다음 하나의 명령으로 파일 링크를 보내십시오. 내 annotations.org 파일 (어쩌면 제목 아래의 부제목으로 디렉토리 이름 일 수 있음)을 작성한 다음 주석 파일에 주석을 쓸 수 있습니다. 그런 다음 하나의 명령으로 모든 파일 (org-mode가 허용)에 도달하거나 외부 프로그램에서 열 수 있어야합니다. 일부 패키지에서 가능합니까?

감사합니다.

답변

2

물론 가능합니다. 그러나 실제 코드가 org-annotate-file.el 인 것 같습니다. here의 주석이있는 함수는 현재 열려있는 파일을 소스로 사용하기 때문에 열지 않은 파일에 주석을 적용하는 것처럼 보이지 않습니다. 그 이름은. (당신이 그것을 제공하는 경우)

(defun org-annotate-file() 
    "Put a section for the current file into your annotation file" 
    (interactive) 
    (error-if-no-file) 
    (org-annotate-file-show-section)) 

적어도 당신이 임의의 파일을 받아 수정할 수 :

(defun org-annotate-file (&optional filename) 
    "Put a section for the current file into your annotation file" 
    (interactive "FFile to tag: ") 
    ; if a file is specified, bypass the check for error when no file 
    (if filename 
    (org-annotate-file-show-section filename) 
    (progn 
     (error-if-no-file) 
     (org-annotate-file-show-section)))) 

이 당신이 할 때마다 파일 이름을 물어 org-annotate-file의 현재 구현이가 Mx org-annotate-file.

파일 이름이나 버퍼를 허용하도록 org-annotate-file-show-section을 변경해야합니다. 첫 번째하자는 다음과 같이해야합니다 :

(defun org-annotate-file-show-section (&optional buffer-or-file) 
    "Visit the buffer named `org-annotate-file-storage-file' and 
show the relevant section" 
    (let* ((line (buffer-substring-no-properties (point-at-bol) (point-at-eol))) 
       (filename (if (stringp buffer-or-file) 
          buffer-or-file 
          (get-filename buffer-or-file (buffer-file-name)))) 
       (link (get-link filename)) 
     (search-link (org-make-link-string 
         (concat "file:" filename "::" line) 
           (org-annotate-file-prettyfy-desc line)))) 
     (show-annotations filename link) 
.... rest of the code.... 

dired 통합은 여기에서 시작할 수 있습니다,하지만 난 ...

편집 여전히 dired API에 익숙하지 않은 해요 : 내가 만드는거야 그 수정을위한 bitbucket의 브랜치. 이 유틸리티는 매우 유용하며 직접 사용할 수도 있습니다. 나는 여기에 링크를 게시 할 것이다. 그리고 여기 있습니다 : https://bitbucket.org/dsevilla/org-annotate-file/src

+0

Nice. 고마워. – anonymous

+0

@Diego Sevilla이 코드를 사용했지만 오류가 발생했습니다. 꽤 오랜 시간이 걸렸으므로이 코드를 만들기위한 모든 업데이트가 새로운 Org와 작동합니까? 감사. – Anusha

관련 문제