Function: tildify-tildify

tildify-tildify is a byte-compiled function defined in tildify.el.gz.

Signature

(tildify-tildify BEG END ASK)

Documentation

Add tilde characters in the region between BEG and END.

This function does not do any further checking except of for comments and macros.

If ASK is nil, perform replace without asking user for confirmation.

Returns (count . response) cons where count is number of string replacements done and response is one of symbols: t (all right), nil
(quit), force (replace without further questions).

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/tildify.el.gz
(defun tildify-tildify (beg end ask)
  "Add tilde characters in the region between BEG and END.
This function does not do any further checking except of for comments and
macros.

If ASK is nil, perform replace without asking user for confirmation.

Returns (count . response) cons where count is number of string
replacements done and response is one of symbols: t (all right), nil
\(quit), force (replace without further questions)."
  (save-excursion
    (goto-char beg)
    (let ((regexp tildify-pattern)
          (match-number 1)
          (tilde (or (with-suppressed-warnings ((obsolete
                                                 tildify--pick-alist-entry))
                       (tildify--pick-alist-entry tildify-string-alist))
                     tildify-space-string))
          (end-marker (copy-marker end))
          answer
          bad-answer
          replace
          quit
          (message-log-max nil)
          (count 0))
      ;; For the time being, tildify-pattern-alist overwrites tildify-pattern
      (let ((alist (with-suppressed-warnings ((obsolete
                                               tildify--pick-alist-entry))
                     (tildify--pick-alist-entry tildify-pattern-alist))))
        (when alist
          (setq regexp (car alist) match-number (cadr alist))))
      (while (and (not quit)
		  (re-search-forward regexp (marker-position end-marker) t))
	(when (or (not ask)
		  (progn
		    (goto-char (match-beginning match-number))
		    (setq bad-answer t)
		    (while bad-answer
		      (setq bad-answer nil)
		      (message "Replace? (yn!q) ")
		      (setq answer (read-event)))
		    (cond
		     ((or (eq answer ?y) (eq answer ? ) (eq answer 'space))
		      (setq replace t))
		     ((eq answer ?n)
		      (setq replace nil))
		     ((eq answer ?!)
		      (setq replace t
			    ask nil))
		     ((eq answer ?q)
		      (setq replace nil
			    quit t))
		     (t
		      (message "Press y, n, !, or q.")
		      (setq bad-answer t)))
		    replace))
	  (replace-match tilde t t nil match-number)
	  (setq count (1+ count))))
      ;; Return value
      (cons count (cond (quit nil)
                        ((not ask) 'force)
                        (t t))))))