;; !SECTION! Possible highlighting of the matching regex\r
\r
(defvar loccur-highlight-matching-regexp t\r
- "If set to a non-nil value, the part of the line matching the\r
-regex is highlighted. Use loccur-toggle-highlight to modify its\r
-value interactively.")\r
+ "Determines if the part of the line matching the regex is highlighted.\r
+If set to a non-nil value, highlight. Use `loccur-toggle-highlight' to\r
+modify its value interactively.")\r
\r
(defcustom loccur-jump-beginning-of-line nil\r
- "Determines if cursor shall be at the beginning of the line\r
-when the loccur function is called.")\r
+ "Set cursor to the beginning of the line when the loccur function is called.")\r
\r
(defun loccur-toggle-highlight()\r
"Toggles the highlighting of the part of the line matching the\r
(,(kbd "RET") . loccur-current)))\r
\r
(defun loccur-toggle-mode (regex)\r
+ "Toggle the function `loccur-mode' for REGEX."\r
(if (or loccur-mode\r
(null regex)\r
(zerop (length regex)))\r
;; !SUBSECTION! History\r
\r
(defvar loccur-history nil\r
- "History of previously searched expressions for the prompt")\r
+ "History of previously searched expressions for the prompt.")\r
(make-variable-buffer-local 'loccur-history)\r
\r
(defvar loccur-last-match nil\r
- "Last match found")\r
+ "Last match found.")\r
(make-variable-buffer-local 'loccur-last-match)\r
\r
\r
"A list of currently active overlays.")\r
(make-variable-buffer-local 'loccur-overlay-list)\r
\r
-(defun loccur-create-highlighted-overlays(buffer-matches)\r
+(defun loccur-create-highlighted-overlays (buffer-matches)\r
+ "Create the list of overlays for BUFFER-MATCHES."\r
(let ((overlays\r
(mapcar (lambda (match)\r
(make-overlay\r
\r
\r
(defun loccur-create-invisible-overlays (ovl-bounds)\r
+ "Create a list of invisible overlays by given OVL-BOUNDS."\r
(let ((overlays\r
(mapcar (lambda (bnd)\r
(make-overlay\r
\r
\r
(defun loccur-remove-overlays ()\r
+ "Remove all overlays."\r
(remove-overlays (point-min) (point-max) loccur-overlay-property-name t)\r
(setq loccur-overlay-list nil))\r
\r
\r
(defun loccur-create-overlay-bounds-btw-lines (buffer-matches)\r
+ "Create a list of overlays between matched lines BUFFER-MATCHES."\r
(let ((prev-end (point-min))\r
(overlays (list)))\r
(when buffer-matches\r
;; !SECTION! Main functions, those actually performing the loccur\r
\r
(defun loccur (regex)\r
- "Perform a simple grep in current buffer for the regular\r
-expression REGEX\r
+ "Perform a simple grep in current buffer.\r
\r
This command hides all lines from the current buffer except those\r
-containing the regular expression REGEX. A second call of the function\r
+containing the regular expression REGEX. A second call of the function\r
unhides lines again"\r
(interactive\r
(if loccur-mode\r
(loccur (current-word)))\r
\r
(defun loccur-prompt ()\r
- "Returns the default value of the prompt.\r
+ "Return the default value of the prompt.\r
\r
Default value for prompt is a current word or active region(selection),\r
if its size is 1 line"\r
\r
\r
(defun loccur-1 (regex)\r
+ "Implementation of the `loccur' functionality.\r
+\r
+REGEX is an argument to `loccur'."\r
(let* ((buffer-matches (loccur-find-matches regex))\r
(ovl-bounds (loccur-create-overlay-bounds-btw-lines buffer-matches)))\r
(setq loccur-overlay-list\r
\r
\r
(defun loccur-find-matches (regex)\r
- "Returns a list of 4-number tuples, specifying begnning of the line,\r
+ "Find all occurences in the current buffer for given REGEX.\r
+\r
+Returns a list of 4-number tuples, specifying begnning of the line,\r
1st match begin of a line, 1st match end of a line, end of a line\r
containing match"\r
(save-excursion\r