Commit debe2de2 authored by Stefan Monnier's avatar Stefan Monnier

Use line-(end|beginning)-position.

(makefile-mode): Set indent-line-function.
(makefile-browser-insert-continuation): Use with-current-buffer.
(makefile-beginning-of-line-point, makefile-end-of-line-point): Remove.
parent eb77a5f4
......@@ -503,15 +503,15 @@ In the browser, use the following keys:
Makefile mode can be configured by modifying the following variables:
Name of the macro- and target browser buffer.
The string that gets appended to all target names
inserted by `makefile-insert-target'.
\":\" or \"::\" are quite common values.
The string that gets appended to all macro names
inserted by `makefile-insert-macro'.
The normal value should be \" = \", since this is what
......@@ -519,35 +519,35 @@ makefile-macro-assign:
allow a larger variety of different macro assignments, so you
might prefer to use \" += \" or \" := \" .
If you want a TAB (instead of a space) to be appended after the
target colon, then set this to a non-nil value.
Number of blanks to the left of the browser selection mark.
Column in which the cursor is positioned when it moves
up or down in the browser.
String used to mark selected entries in the browser.
String used to mark unselected entries in the browser.
If this variable is set to a non-nil value the cursor
will automagically advance to the next line after an item
has been selected in the browser.
If this variable is set to a non-nil value then
`makefile-pickup-everything' also picks up filenames as targets
(i.e. it calls `makefile-pickup-filenames-as-targets'), otherwise
filenames are omitted.
If this variable is set to a non-nil value then Makefile mode
will assure that no line in the file ends with a backslash
(the continuation character) followed by any whitespace.
......@@ -556,11 +556,11 @@ makefile-cleanup-continuations-p:
IMPORTANT: Please note that enabling this option causes Makefile mode
to MODIFY A FILE WITHOUT YOUR CONFIRMATION when \"it seems necessary\".
A function or list of functions to be called just before the
browser is entered. This is executed in the makefile buffer.
List of special targets. You will be offered to complete
on one of those in the minibuffer whenever you enter a `.'.
at the beginning of a line in Makefile mode."
......@@ -611,6 +611,9 @@ makefile-special-targets-list:
(make-local-variable 'comment-start-skip)
(setq comment-start-skip "#+[ \t]*")
;; Make sure TAB really inserts \t.
(set (make-local-variable 'indent-line-function) 'indent-to-left-margin)
;; become the current major mode
(setq major-mode 'makefile-mode)
(setq mode-name "Makefile")
......@@ -1055,10 +1058,7 @@ definition and conveniently use this command."
;; Have a macro assign. Fill just this line, and then backslash
;; resulting region.
(narrow-to-region (point) (save-excursion
(narrow-to-region (point) (line-beginning-position 2))
(let ((fill-paragraph-function nil))
(fill-paragraph nil))
(makefile-backslash-region (point-min) (point-max) nil)))))
......@@ -1185,8 +1185,7 @@ This is most useful in the process of creating continued lines when copying
large dependencies from the browser to the client buffer.
\(point) advances accordingly in the client buffer."
(set-buffer makefile-browser-client)
(with-current-buffer makefile-browser-client
(insert "\\\n\t")))
......@@ -1451,20 +1450,20 @@ This acts according to the value of `makefile-tab-after-target-colon'."
"Determine if point is on a macro line in the browser."
(re-search-forward "\\$[{(]" (makefile-end-of-line-point) t)))
(re-search-forward "\\$[{(]" (line-end-position) t)))
(defun makefile-browser-this-line-target-name ()
"Extract the target name from a line in the browser."
(skip-chars-backward "^ \t")
(buffer-substring (point) (1- (makefile-end-of-line-point)))))
(buffer-substring (point) (1- (line-end-position)))))
(defun makefile-browser-this-line-macro-name ()
"Extract the macro name from a line in the browser."
(re-search-forward "\\$[{(]" (makefile-end-of-line-point) t)
(re-search-forward "\\$[{(]" (line-end-position) t)
(let ((macro-start (point)))
(skip-chars-forward "^})")
(buffer-substring macro-start (point)))))
......@@ -1488,21 +1487,11 @@ Uses `makefile-use-curly-braces-for-macros-p'."
(defun makefile-browser-toggle-state-for-line (n)
(makefile-browser-set-state-for-line n (not (makefile-browser-get-state-for-line n))))
(defun makefile-beginning-of-line-point ()
(defun makefile-end-of-line-point ()
(defun makefile-last-line-p ()
(= (makefile-end-of-line-point) (point-max)))
(= (line-end-position) (point-max)))
(defun makefile-first-line-p ()
(= (makefile-beginning-of-line-point) (point-min)))
(= (line-beginning-position) (point-min)))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment