2012年6月28日

bbdb kanji being corrupped on save

when i have kanji in a name and then save the .bbdb, i end up with \mush
in the file and lose the kanji. i tried saving in mule,
iso-this-and-that, etc. no love. same problem for extended latin
alphabets.

it is likely my fault, as i seem to have accumulated an amazing amount
of bbdb cruft.

randy

(require 'bbdb-wl)
(bbdb-wl-setup)
;; enable pop-ups
(setq bbdb-use-pop-up nil)
;; auto collection
(setq bbdb/mail-auto-create-p nil)
;; exceptional folders against auto collection
(setq bbdb-wl-ignore-folder-regexp "^@")
(setq signature-use-bbdb t)
(setq bbdb-north-american-phone-numbers-p nil)
;; shows the name of bbdb in the summary :-)
(setq wl-summary-from-function 'bbdb-wl-from-func)
;; print full names as much as possible
(setq bbdb-dwim-net-address-allow-redundancy t)

;; bbdb gather from message send addresses
(defun zzz-bbdb-mail-send-function ()
(bbdb-update-records
(delete-if (lambda (item)
(string= "" (caaddr item)))
(bbdb-wl-get-addresses bbdb-get-only-first-address-p))
t t))
(add-hook 'mail-send-hook 'zzz-bbdb-mail-send-function)

; canonicalize bbdb names
; Len Trigg <lenbok+mlbbdb@xxxxx>
(defun zzz-bbdb-canonicalize-name-hook (name)
"Function used to canonicalize the full names of bbdb entries."
(cond
;; strip extra quotes (Some MS mailer likes "'full name'")
((string-match "\\`[`'\"]\\(.*\\)[`'\"]\\'" name)
(bbdb-match-substring name 1))
;; replace multiple whitespace with single
((string-match "[ \f\t\n\r\v]\\{2,\\}" name)
(replace-match " " nil t name))
;; remove anything in round brackets, e.g.: "Firstname Surname (E-mail)"
((string-match "[ ]+(.*)" name)
(replace-match "" nil t name))
;; strip leading whitespace (this is a bug in std11 libs?)
((string-match "\\`[ \t]+\\(.*\\)" name)
(bbdb-match-substring name 1))
;; strip trailing whitespace
((string-match "\\(.*\\)[ ]+\\'" name)
(bbdb-match-substring name 1))
;; strip Dr pronoun
((string-match "\\`Dr\\.? \\(.*\\)" name)
(bbdb-match-substring name 1))
;; person and person -> person & person
((string-match "\\`\\(\\w+\\) and \\(\\w.+\\)\\'" name)
(concat (bbdb-match-substring name 1) " & " (bbdb-match-substring name 2)))
;; Surname, Firstname -> Firstname Surname
((string-match "\\`\\(\\w.+\\), \\(\\w.+\\)\\'" name)
(concat (bbdb-match-substring name 2) " " (bbdb-match-substring name 1)))
;; replace name without any whitespace with empty; I don't want bbdb names containing only a single name
((string-match "\\`\\(\\w+\\)\\'" name)
;;(message (format "Eliding name %s" name))
"")
(t name)))

;; make bbdb-wl-canonicalize-full-name-function behave like
;; bbdb-canonicalize-net-hook. (much more useful, imo)
(defun zzz-bbdb-canonicalize-name (name)
(when name ;name is sometimes nil?
(while (not (eq name (setq name (zzz-bbdb-canonicalize-name-hook name))))
;;(insert-string (concat name "\n"))
))
name)

(setq bbdb-wl-canonicalize-full-name-function 'zzz-bbdb-canonicalize-name)


投稿者 xml-rpc : 2012年6月28日 23:11
役に立ちました?:
過去のフィードバック 平均:(0) 総合:(0) 投票回数:(0)
本記事へのTrackback: http://hoop.euqset.org/blog/mt-tb2006.cgi/110360
トラックバック
コメント
コメントする




画像の中に見える文字を入力してください。