From b20aeaa3826135a8696f82a82267a667bcc2d2b5 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bernardy Date: Thu, 23 Oct 2014 13:14:38 +0200 Subject: [PATCH] remove duplicated code --- boon-main.el | 53 +--------------------------------------------------- 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/boon-main.el b/boon-main.el index daae16d..91ef133 100644 --- a/boon-main.el +++ b/boon-main.el @@ -319,63 +319,12 @@ line." (unless (funcall progress) (end-of-line))))) -(defun blank-string-p (string) - "Is the argument composed only of spaces and other blank characters?" - (equal "" (replace-regexp-in-string "[[:space:]]" "" string))) (defun boon-line-prefix () "return the text between beginning of line and position" (buffer-substring-no-properties - (line-beginning-position) + (line-beginning-position) (point))) -(defun boon-beginning-of-line () - "Move point to the first non-whitespace character on this line. -If point was already at that position, move point to beginning of -line." - (interactive) - (let ((oldpos (point))) - (beginning-of-line) - (when (= oldpos (point)) - (back-to-indentation)))) - -(defun boon-looking-at-comment (how-many) - "Is the current point looking at 'how many' comments? (negative for backwards)" - (save-excursion - (forward-comment how-many))) - -(defun boon-in-string-p () - "Determine if the point is inside a string" - (nth 3 (syntax-ppss))) - -(defun looking-at-line-comment-start-p () - "Are we looking at a comment-start? (and not in a string)" - (interactive) - (and (boundp 'comment-start) - comment-start - (looking-at comment-start) - (not (boon-in-string-p)))) - -(defun boon-end-of-line () - "Toggle between jumping to 1. the last character of code on the -line 2. the last non-blank char on the line 3. the true end of -line." - (interactive) - (let* ((orig (point)) - (orig-eol (eolp)) - (progress (lambda () (and (not (bolp)) (or orig-eol (> (point) orig)))))) - (beginning-of-line) - (while (not (or (looking-at-line-comment-start-p) (eolp))) - (forward-char)) - ;; we're now at the last non-comment character of the line - (skip-chars-backward "\n\t " (line-beginning-position)) - ;; we're now at the last non-blank, non-comment character of the line - (unless (funcall progress) - (end-of-line) - (skip-chars-backward "\n\t " (line-beginning-position)) - ;; we're now at the last non-blank character of the line - (unless (funcall progress) - (end-of-line))))) - (defun blank-string-p (string) "Is the argument composed only of spaces and other blank characters?" (equal "" (replace-regexp-in-string "[[:space:]]" "" string)))