Next: , Up: Bucket Index HTML  


A.4.1 Get Bucket Name

This code searches for the keyword-value pair ‘bucket:<BUCKET-NAME>’ that should be located towards the beginning of the file, and returns the value ‘BUCKET-NAME’ or nil if not found.

(save-excursion
  (goto-char (point-min))
  (re-search-forward "^#\\+bucket:\\s*?\\(.*\\)$" nil t)
  (match-string-no-properties 1))

For some reason, get-bucket-name does not work when called from the headline Links for bucket below when creating ‘index.html’, even if it returns as (prin1 ...) and is set up to :return output; the call receives ‘nil’. The following code from bucket-name, however, works. I don’t know why.

(prin1 bucket-name)