Function: kotl-mode:set-cell-attribute

kotl-mode:set-cell-attribute is an interactive and byte-compiled function defined in kotl-mode.el.

Signature

(kotl-mode:set-cell-attribute ATTRIBUTE VALUE &optional POS TOP-CELL-FLAG)

Documentation

Include ATTRIBUTE VALUE with the current cell or the cell at optional POS.

Replace any existing value that ATTRIBUTE has. With optional prefix arg TOP-CELL-FLAG non-nil, modify the hidden top cell's ATTRIBUTE and ignore any value of POS.

When called interactively, display the setting in the minibuffer as confirmation.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/kotl-mode.el
(defun kotl-mode:set-cell-attribute (attribute value &optional pos top-cell-flag)
  "Include ATTRIBUTE VALUE with the current cell or the cell at optional POS.
Replace any existing value that ATTRIBUTE has.  With optional prefix arg
TOP-CELL-FLAG non-nil, modify the hidden top cell's ATTRIBUTE and ignore any
value of POS.

When called interactively, display the setting in the minibuffer as
confirmation."
  (interactive
   (let* ((plist (copy-sequence (kcell-view:plist)))
	  (existing-attributes plist)
	  (top-cell-flag (zerop (prefix-numeric-value
				 current-prefix-arg)))
	  attribute value)
     (barf-if-buffer-read-only)
     ;; Remove attribute values leaving only attribute symbols in existing-attributes.
     (while plist
       (setcdr plist (cdr (cdr plist)))
       (setq plist (cdr plist)))
     ;; Remove read-only attributes
     (setq existing-attributes (apply #'set:create existing-attributes)
	   existing-attributes (set:difference
				existing-attributes
				kcell:read-only-attributes))

     (while (zerop (length (setq attribute
				 (completing-read
				  (format "Name of attribute to set in cell <%s>: "
					  (if top-cell-flag
					      "0"
					    (kcell-view:label)))
				  (mapcar 'list
					  (mapcar 'symbol-name
						  existing-attributes))))))
       (beep))
     (setq attribute (intern attribute)
	   value (if top-cell-flag
		     (kcell:get-attr (kview:top-cell kotl-kview) attribute)
		   (kcell-view:get-attr attribute)))
     (if value
	 (setq value (read-minibuffer
		      (format "Change the value of `%s' to (use double quotes around a string): " attribute)
		      (prin1-to-string value)))
       (setq value (read-minibuffer
		    (format "Set attribute `%s' to (use double quotes around a string): " attribute))))
     (list attribute value nil current-prefix-arg)))
  (barf-if-buffer-read-only)
  (if top-cell-flag
      (kcell:set-attr (kview:top-cell kotl-kview) attribute value)
    (kcell-view:set-attr attribute value pos))
  ;; Note that buffer needs to be saved to store new attribute value.
  (set-buffer-modified-p t)
  (when (called-interactively-p 'interactive)
    (message "Attribute `%s' set to `%s' in cell <%s>."
	     attribute value   (if top-cell-flag
				   "0"
				 (kcell-view:label pos)))))