2016-06-28 4 views
0

히브리어 기념일 (생일 등)을 조직 일정에 표시하는 방법은 무엇입니까? BBDB를 통해 최선을 다할 것입니다. 지금까지 BBDB에 기념일/생일을 추가하고이를 조직 의제에 표시했습니다. 이제 다음 단계로 이동하여 그 날짜를 히브리어 날짜로 제공해야합니다. 일기 모드에서 날짜는 HSivan 17, 5776처럼 보입니다. 그러나 내가 anniversary: HSivan 17, 5776 birthday 같은 BBDB에 삽입하면 - 의제보기를 생성하는 동안 오류가 발생합니다 : bad-sexp at line 5 /path/to/agenda.org (org-bbdb-anniversaries). 어쩌면 다른 방법 (BBDB없이)이있을 수 있습니다. 어쩌면 .org 파일로 직접 나열 할 수 있습니까?히브리 기념일을 조직 의제에 표시되도록 정의하는 방법은 무엇입니까?

답변

1

, 조직 모드 ISO 기반의 서부 캘린더.

형식이 다른 날짜를 bbdb에 저장하려면 org-bbdb-extract-date-fun을 사용자 정의 할 수 있습니다. 히브리어 날짜를 파싱하고 돌아 오는 (월 일 년) 함수를 작성해야합니다.

히브리어 날짜를 사용하여 bbdb 데이터베이스를 사용할 수는 있지만 이 아닌이 표시됩니다 (예 : 히브리어 날짜를 사용하는 일정 목록 출력). ISO 캘린더 가정이 org-mode 코드 기반을 침투하기 때문에 특히 더 어려운 문제입니다.

편집 :

;;; This function uses functions and variables defined in calendar.el 
;;; and cal-hebrew.el 

(require 'calendar) 
(require 'cal-hebrew) 

(defun org-bbdb-anniv-extract-hebrew-date (date-string) 
    "Parse the string, assumed to be in the form \"MONTHNAME day, 
    year\", using Hebrew month names. Day is an integer, roughly 
    between 1 and 30 (the range depends on the month and the 
    year), and year is an integer representing a Hebrew calendar 
    year (roughly 5776 ~= 2015)." 
    (let* ((date-list (split-string date-string)) 
      (month-name (nth 0 date-list)) 
      (day (string-to-number (nth 1 date-list))) 
      (year (string-to-number (nth 2 date-list))) 
      (month-array (if (calendar-hebrew-leap-year-p year) 
          calendar-hebrew-month-name-array-leap-year 
          calendar-hebrew-month-name-array-common-year)) 
      (month (cdr (assoc-string 
         month-name 
         (calendar-make-alist month-array 1))))) 
     (calendar-gregorian-from-absolute 
     (calendar-hebrew-to-absolute (list month day year))))) 

;; test: (org-bbdb-anniv-extract-hebrew-date "Heshvan 17, 5776") ==> (10 30 2015) 
;; test: (org-bbdb-anniv-extract-hebrew-date "Heshvan 17, 3762") ==> (10 22 1) 
;; I hope these are right. 

;; To get org-bbdb to use this function to read dates from the BBDB 
;; database, instead of the standard org-bbdb-anniv-extract-date, do 
;; this: 

;; (setq org-bbdb-extract-date-fun #'org-bbdb-anniv-extract-hebrew-date) 

;; N.B. *ALL* dates in the BBDB database will be read using this 
;; function, so *ALL* of them must be Hebrew calendar dates. There is 
;; no provision for dates in different formats. To do that, one would 
;; need to write a function that can recognize dates in different 
;; formats (probably using heuristics) and then call the right 
;; conversion function. That's beyond the scope of this answer. 

;; Also, calendrical calculations are notoriously difficult to get 
;; right: this is no exception. In particular, the month calculation 
;; is probably valid only for dates in the Common Era, i.e. for years 
;; >= 3762. cal-hebrew.el has more details. But in any case, no 
;; guarantees: if it breaks, you get to keep the pieces. 
+0

기념일이 ISO 캘린더에 표시된다는 것은 괜찮습니다. 내가 필요로하는 유일한 것은 히브리어 날짜에 해당하는 ISO 날짜에 표시된다는 것입니다. – user1876484

+0

그런 다음 위에 제안 된대로 함수를 작성하면 충분합니다. 'org-bbdb-anniv-extract-date'에서 모델링 할 수 있지만 'YYYY-MM-DD'형식의 문자열을 사용하는 대신 히브리어 날짜 문자열을 사용합니다. 변환을 위해 캘린더 기능을 사용할 수는 있지만 그건 제가 아는 바입니다. – Nick

+1

cal-hebrew.el에는 다음과 같은 달 이름 배열이 있습니다.'(defconst calendar-hebrew-month-name-array-common-year [ "Nisan" "Iyar" "Sivan" "Tammuz" "Av" "Elul" "Tishri" "Heshvan" "Kislev" "Teveth" "Shevat" "Adar"] "공통 연도의 히브리어 달의 이름을 나타내는 문자열 배열.")'. 달은 정수로 나타냅니다. 0 기반을 가정 할 때, "Heshvan"은 7이므로 Heshvan 17, 5776은 (7 17 5776)으로 표시됩니다. 변환은'(calendar-gregian-from-absolute (calendar-hebrew-to-absolute) (7 17 5776))')으로 이루어지며 (9 30 3015). – Nick

0

나는 당신이 당신의 .emacs이 퍼팅하여 bbdb의 문제를 해결할 수 있다고 생각 : 이외의 달력과 잘 (또는 모두)를 처리하지 않습니다 일반적으로

(require 'org-bbdb) 
+0

이 줄하지 않았다 추가 : 여기 (월, 일, 년) 인수로 "Heshvan 17, 5776"와 같은 문자열을 받아 생산하는 기능을 사용할 수있는 조직을 튜플이다 문제를 해결하십시오. 사실 그레고리오 시대에 근무하고 있습니다. 나는 Agenda보기 생성 중에 히브리어 날짜를 그레고리력으로 변환하는 방법이 필요합니다. 재미있는 점 : "기념일 : HSivan 23, 5776 birthday"라고 쓰면 위와 같은 오류가 발생하지만 '기념일 : H5776-03-23 ​​생일'과 같은 ISO 스타일로 작성하면 아무런 오류가 없지만 생일은 표시되지 않습니다. 방금 Chineese와 비슷한 질문을 발견했습니다. (http://stackoverflow.com/questions/36557402/viewing-chinese-korean-lunar-birthday-on-org-agenda). – user1876484

+0

죄송하지만이 문제에 관해서 당신이하는 것보다 더 많이 알지 못합니다. Emacs 문서 (https://www.gnu.org/software/emacs/manual/html_node/emacs/Other-Calendars.html#Other-Calendars)를 둘러 보거나 히브리어 달력의 소스 코드를 읽으십시오. 나를 위해/usr/local/share/emacs/24.4/lisp/calendar/cal-hebrew.el.gz에 위치해 있습니다. –