
(require (quote hbmap))

(defun hbdata:action (hbdata) "\
[Hyp V2] Returns action overriding button's action type or nil." (byte-code "Á8‡" [hbdata 1] 2))

(defun hbdata:actype (hbdata) "\
Returns the action type in HBDATA as a string." (byte-code "ÂÃ	8!… GÄU† ÅÆ\"ƒ ‚ ÇP)‡" [nm hbdata symbol-name 3 2 string-match "::" "actypes::"] 4))

(defun hbdata:args (hbdata) "\
Returns the list of any arguments given in HBDATA." (byte-code "Á8‡" [hbdata 4] 2))

(defun hbdata:categ (hbdata) "\
Returns the category of HBDATA's button." (byte-code "À‡" [explicit] 1))

(defun hbdata:creator (hbdata) "\
Returns the user-id of the original creator of HBDATA's button." (byte-code "Á8‡" [hbdata 5] 2))

(defun hbdata:create-time (hbdata) "\
Returns the original creation time given for HBDATA's button." (byte-code "Á8‡" [hbdata 6] 2))

(defun hbdata:key (hbdata) "\
Returns the indexing key in HBDATA as a string." (byte-code "@‡" [hbdata] 1))

(defun hbdata:loc-p (hbdata) "\
[Hyp V1] Returns 'L iff HBDATA referent is within a local file system.
Returns 'R if remote and nil if irrelevant for button action type." (byte-code "Á8‡" [hbdata 1] 2))

(defun hbdata:modifier (hbdata) "\
Returns the user-id of the most recent modifier of HBDATA's button.
Nil is returned when button has not been modified." (byte-code "Á8‡" [hbdata 7] 2))

(defun hbdata:mod-time (hbdata) "\
Returns the time of the most recent change to HBDATA's button.
Nil is returned when button has not beened modified." (byte-code "Á8‡" [hbdata 8] 2))

(defun hbdata:referent (hbdata) "\
Returns the referent name in HBDATA." (byte-code "Á8‡" [hbdata 2] 2))

(defun hbdata:search (buf label partial) "\
Go to Hyperbole hbdata BUF and find LABEL whole or PARTIAL matches.
 Search is case-insensitive.  Returns list with elements:
 (<button-src> <label-key1> ... <label-keyN>)." (byte-code "qˆÂÄÄÄÄebˆÊËÄÂ#…� ÌÍÎ!ÏÎ!\"Ä‰ˆŠÊÐÄÂ#ƒ6 `S‚7 d‰)ˆÊÑÒ…E ÓÔÕ	!!…Q ÓÖ%ÄÂ#…k ÌÍÎ!ÏÎ!\"B‰ˆ‚< ˆ…y BB‰ˆbˆ‚ ˆ-‡" [buf case-fold-search t src-matches nil src matches end partial label re-search-forward "^
\"\\([^\"]+\\)\"" buffer-substring match-beginning 1 match-end "^" concat "^(\"\\(" "[^\"]*" regexp-quote ebut:label-to-key "\\)\""] 16))

(defun hbdata:build (&optional mod-lbl-key but-sym) "\
Tries to construct button data from optional MOD-LBL-KEY and BUT-SYM.
MOD-LBL-KEY nil means create a new entry, otherwise modify existing one.
BUT-SYM nil means use 'hbut:current'.  If successful, returns a cons of
 (button-data . button-instance-str), else nil." (byte-code "ÁØ† ÙÀ\"Ú
Î\"† Ú
Û\"ƒ& Ú
Û\"‚' ÁÁ	Á
ÁÁÁÁÁ?ƒJ Á‚‰Ü!ƒT ‚W Ý!Ü!ƒc Á‚f Þ!‰ˆß?$‰…ÿ ƒá à!	á!
â Pã	\"ƒ¤ ‚¦ *ä AB‰ˆå ˆæ#‰…Þ TP‰ˆç\"…Þ èé!‚ÿ æ#…û êë!Q!‰)ˆ†?…‰ìPÚ
í\"Ú
î\"Ú
Õ\"…I9…Iï!‰…Iðñò\"ƒEóô!‚FôÁO!)õö!…Sö!Ú
×\"÷øƒkù\"‚m\"*	†yâ P
†€ä &	B.‡" [but nil b but-sym l key mod-lbl-key new-key lbl-instance creator create-time modifier mod-time entry loc dir user addr hyperb:host-domain ebut:instance-sep inst-num actype mail-dir args hattr:copy hbut:current hattr:get lbl-key bufferp file-name-nondirectory file-name-directory hbdata:to-entry hbdata:creator hbdata:create-time user-login-name equal htz:date-sortable-gmt hbdata:delete-entry-at-point hbdata:instance-last hbdata:to-entry-buf forward-line 1 hbdata:instance-next int-to-string list action referent symbol-name intern string-match "::" match-end 0 fboundp hmail:composing-dir mapcar hpath:substitute-var action:path-args-abs] 45))

(defun hbdata:get-entry (lbl-key key-src &optional directory) "\
Returns button data entry given by LBL-KEY, KEY-SRC and optional DIRECTORY.
Returns nil if no matching entry is found.
A button data entry is a list of attribute values.  Use methods from
class 'hbdata' to operate on the entry." (byte-code "ÃÄ	
$‡" [lbl-key key-src directory hbdata:apply-entry (read (current-buffer))] 5))

(defun hbdata:instance-next (lbl-key) "\
Returns string for button instance number following LBL-KEY's.
nil if LBL-KEY is nil." (byte-code "…! ÂÃ	!ÄP\"ƒ  	ÅÆÇÈ!TÉO!T!P‚! Ê‡" [lbl-key ebut:instance-sep string-match regexp-quote "[0-9]+$" int-to-string string-to-int match-beginning 0 nil ":2"] 9))

(defun hbdata:instance-last (lbl-key key-src &optional directory) "\
Returns highest instance number for repeated button label.
1 if not repeated, nil if no instance.
Takes arguments LBL-KEY, KEY-SRC and optional DIRECTORY." (byte-code "ÄÅ	
ÃÆ&‡" [lbl-key key-src directory nil hbdata:apply-entry (if (looking-at "[0-9]+") (string-to-int (buffer-substring (match-beginning 0) (match-end 0))) 1) instance] 7))

(defun hbdata:delete-entry (lbl-key key-src &optional directory) "\
Deletes button data entry given by LBL-KEY, KEY-SRC and optional DIRECTORY.
Returns entry deleted (a list of attribute values) or nil.
Use methods from class 'hbdata' to operate on the entry." (byte-code "ÃÄ	
$‡" [lbl-key key-src directory hbdata:apply-entry (prog1 (read (current-buffer)) (let ((empty-file-entry "[ 	
]*\\(\\|\\'\\)") (kill)) (beginning-of-line) (hbdata:delete-entry-at-point) (if (looking-at empty-file-entry) (let ((end (point)) (empty-hbdata-file "[ 	
]*\\'")) (forward-line -1) (if (= (following-char) 34) (progn (forward-line -1) (delete-region (point) end))) (save-excursion (goto-char (point-min)) (if (looking-at empty-hbdata-file) (setq kill t))) (if kill (let ((fname buffer-file-name)) (erase-buffer) (save-buffer) (kill-buffer nil) (hbmap:dir-remove (file-name-directory fname)) (call-process "rm" nil 0 nil "-f" fname)))))))] 5))

(defun hbdata:delete-entry-at-point nil (byte-code "À`ÁÂ!ˆ`\"‡" [delete-region forward-line 1] 4))

(defun hbdata:to-entry (but-key key-src &optional directory instance) "\
Returns button data entry indexed by BUT-KEY, KEY-SRC, optional DIRECTORY.
Returns nil if entry is not found.  Leaves point at start of entry when
successful or where entry should be inserted if unsuccessful.
A button entry is a list.  Use methods from class 'hbdata' to operate on the
entry.  Optional INSTANCE non-nil means search for any button instance matching
but-key." (byte-code "ÅÆ	
Ç&È
\"ˆÉÊ!ˆ… @bˆA)‡" [pos-entry-cons but-key key-src directory instance hbdata:apply-entry (progn (beginning-of-line) (cons (point) (read (current-buffer)))) create hbdata:to-entry-buf forward-line 1] 7))

(defun hbdata:apply-entry (expr lbl-key key-src &optional directory create instance) "\
Evals EXPR at hbdata entry given by LBL-KEY, KEY-SRC, optional DIRECTORY.
With optional CREATE, if no such line exists, inserts a new file entry at the
beginning of the hbdata file (which is created if necessary).
INSTANCE non-nil means search for any button instance matching LBL-KEY and
evaluate EXPR with point right after any 'ebut:instance-sep' in match.
Returns value of evaluation when a matching entry is found or nil." (byte-code "ÁÁÁÁŒŠÐŽÑ!… qˆÒ … Ó ˆÔ ƒ, `pÕ‰‚@ Ö …6 × ˆØ …@ `pÙ‰ˆÚ#‰)))ˆ
,‡" [found nil rtn opoint end-form key-src directory create case-fold-search t qkey lbl-key end instance buffer-read-only expr ((byte-code "…= ÂÌ!ŠÍÎÆÂ#ƒ `‚ d)Ïƒ$ Ð‚% Ñ!…< †0 Ò ˆÆÏ
!‰	)+ˆÏ!‡" [found case-fold-search t qkey lbl-key end nil instance buffer-read-only rtn expr end-form regexp-quote search-forward "
" eval (re-search-forward (concat "
(\"" qkey "[" ebut:instance-sep "\"]") end t) (search-forward (concat "
(\"" lbl-key "\"") end t) beginning-of-line] 7)) bufferp hmail:lister-p rmail:summ-msg-to rmail:to (progn (hmail:msg-narrow) (goto-char opoint) (lmail:to)) hnews:lister-p rnews:summ-msg-to rnews:to (progn (hmail:msg-narrow) (goto-char opoint) (lnews:to)) hbdata:to-entry-buf] 11))

(defun hbdata:to-hbdata-buffer (dir &optional create) "\
Reads in the file containing DIR's hyper-data, if any, and returns buffer.
If it does not exist and optional CREATE is non-nil, creates a new
one and returns buffer, otherwise returns nil." (byte-code "Ê	
† \"Ë!† Ì!Ì!†% † …% Í!…n qˆÎÌ!!†? ÏÐ!…? ÑÇÇ\"ˆdÒU†Q ÒfÓ=†Q ÔÕ\"ˆÖ× \"†] Ø!ˆÉ‰ˆ†l ÙÚ!!ˆ+‡" [file hattr:filename dir default-directory existing-file buf create t buffer-read-only nil expand-file-name file-exists-p get-file-buffer find-file-noselect verify-visited-file-modtime yes-or-no-p "Hyper-button data file has changed, read new contents? " revert-buffer 1 12 error "File %s is not a valid hyper-data table." equal buffer-name rename-buffer hbmap:dir-add file-name-directory] 16))

(defun hbdata:to-entry-buf (key-src &optional directory create) "\
Moves point to end of line in but data buffer matching KEY-SRC.
Uses hbdata file in KEY-SRC's directory, or optional DIRECTORY or if nil, uses
default-directory.
With optional CREATE, if no such line exists, inserts a new file entry at the
beginning of the hbdata file (which is created if necessary).
Returns non-nil if KEY-SRC is found or created, else nil." (byte-code "ÁÁË!ƒ# qÁ‰ˆÌ ?… ÍÎÎ#ˆÏÐ!‚§ Ñ!†+ ‰ˆÁÒ!‰…H ‰ˆ‚5 ˆƒ\\ Ñ!Ó!‰‚a Ó!‰*ˆÔ	\"†~ 
…~ Ô
Á\"…~ Á	
‰…§ ÐbˆÕÖ×QÁÊ#ƒ• Ê‰‚§ 	…§ Ê‰ˆÍÖØ#ˆÏÐ!ˆ*‡" [rtn nil ln-dir key-src buffer-read-only hmail:hbdata-sep directory ln-file link-p create t bufferp hmail:hbdata-to-p insert "
" backward-char 1 file-name-directory file-symlink-p file-name-nondirectory hbdata:to-hbdata-buffer search-forward "
\"" "\"" "\"
"] 16))

(defun hbdata:write (&optional orig-lbl-key but-sym) "\
Tries to write Hyperbole button data from optional ORIG-LBL-KEY and BUT-SYM.
ORIG-LBL-KEY nil means create a new entry, otherwise modify existing one.
BUT-SYM nil means use 'hbut:current'.  If successful, returns 
a button instance string to append to button label or t when first instance.
On failure, returns nil." (byte-code "È	
\"ÆÆ… É!?† ?ƒ Æ‚3 @A‰ˆÊp\"ˆËp!ˆ†3 Ç+‡" [cns orig-lbl-key but-sym entry lbl-instance buffer-file-name nil t hbdata:build file-writable-p prin1 terpri] 5))

(provide (quote hbdata))
