Function: reftex-index-edit-part

reftex-index-edit-part is a byte-compiled function defined in reftex-index.el.gz.

Signature

(reftex-index-edit-part ARG N INITIAL PROMPT &optional DONT-ALLOW-EMPTY)

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/reftex-index.el.gz
(defun reftex-index-edit-part (arg n initial prompt &optional dont-allow-empty)
  ;; This function does the work for all partial editing commands
  (let* ((data (get-text-property (point) :data))
         new analyze opart npart)
    (unless data (error "Don't know which index entry to edit"))
    ;; Analyze the whole context string
    (setq analyze (reftex-index-analyze-entry data)
          opart (nth n analyze))
    (and (> (length opart) 0) (setq opart (substring opart 1)))
    ;; Have the user editing the part
    (setq npart (if arg "" (read-string (concat prompt initial) opart)))
    ;; Tests:
    (cond ((string= npart opart)
           (error "Not changed"))
          ((string= npart "")
           (if dont-allow-empty
               (error "Invalid value")
             (setf (nth n analyze) npart)))
          (t (setf (nth n analyze) (concat initial npart))))
    (setq new (apply #'concat analyze))
    ;; Change the entry and insert the changed version into the index.
    (reftex-index-change-entry
     new (if (string= npart "")
             (format "Deleted: %s" opart)
           (format "New value is: %s" npart)))))