diff options
| author | Stefan Monnier | 2001-11-28 20:40:36 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-11-28 20:40:36 +0000 |
| commit | debe2de2979115d3094322e795c0fc7ccd96bd97 (patch) | |
| tree | 12e394e9b045189ba3713ef81d47dd8f1a02fd17 | |
| parent | eb77a5f44a20d61b3b51c7a14f70be4acdca8004 (diff) | |
| download | emacs-debe2de2979115d3094322e795c0fc7ccd96bd97.tar.gz emacs-debe2de2979115d3094322e795c0fc7ccd96bd97.zip | |
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.
| -rw-r--r-- | lisp/progmodes/make-mode.el | 57 |
1 files changed, 23 insertions, 34 deletions
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index 3ce6cdb0195..94fc375d1fc 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el | |||
| @@ -503,15 +503,15 @@ In the browser, use the following keys: | |||
| 503 | 503 | ||
| 504 | Makefile mode can be configured by modifying the following variables: | 504 | Makefile mode can be configured by modifying the following variables: |
| 505 | 505 | ||
| 506 | makefile-browser-buffer-name: | 506 | `makefile-browser-buffer-name': |
| 507 | Name of the macro- and target browser buffer. | 507 | Name of the macro- and target browser buffer. |
| 508 | 508 | ||
| 509 | makefile-target-colon: | 509 | `makefile-target-colon': |
| 510 | The string that gets appended to all target names | 510 | The string that gets appended to all target names |
| 511 | inserted by `makefile-insert-target'. | 511 | inserted by `makefile-insert-target'. |
| 512 | \":\" or \"::\" are quite common values. | 512 | \":\" or \"::\" are quite common values. |
| 513 | 513 | ||
| 514 | makefile-macro-assign: | 514 | `makefile-macro-assign': |
| 515 | The string that gets appended to all macro names | 515 | The string that gets appended to all macro names |
| 516 | inserted by `makefile-insert-macro'. | 516 | inserted by `makefile-insert-macro'. |
| 517 | The normal value should be \" = \", since this is what | 517 | The normal value should be \" = \", since this is what |
| @@ -519,35 +519,35 @@ makefile-macro-assign: | |||
| 519 | allow a larger variety of different macro assignments, so you | 519 | allow a larger variety of different macro assignments, so you |
| 520 | might prefer to use \" += \" or \" := \" . | 520 | might prefer to use \" += \" or \" := \" . |
| 521 | 521 | ||
| 522 | makefile-tab-after-target-colon: | 522 | `makefile-tab-after-target-colon': |
| 523 | If you want a TAB (instead of a space) to be appended after the | 523 | If you want a TAB (instead of a space) to be appended after the |
| 524 | target colon, then set this to a non-nil value. | 524 | target colon, then set this to a non-nil value. |
| 525 | 525 | ||
| 526 | makefile-browser-leftmost-column: | 526 | `makefile-browser-leftmost-column': |
| 527 | Number of blanks to the left of the browser selection mark. | 527 | Number of blanks to the left of the browser selection mark. |
| 528 | 528 | ||
| 529 | makefile-browser-cursor-column: | 529 | `makefile-browser-cursor-column': |
| 530 | Column in which the cursor is positioned when it moves | 530 | Column in which the cursor is positioned when it moves |
| 531 | up or down in the browser. | 531 | up or down in the browser. |
| 532 | 532 | ||
| 533 | makefile-browser-selected-mark: | 533 | `makefile-browser-selected-mark': |
| 534 | String used to mark selected entries in the browser. | 534 | String used to mark selected entries in the browser. |
| 535 | 535 | ||
| 536 | makefile-browser-unselected-mark: | 536 | `makefile-browser-unselected-mark': |
| 537 | String used to mark unselected entries in the browser. | 537 | String used to mark unselected entries in the browser. |
| 538 | 538 | ||
| 539 | makefile-browser-auto-advance-after-selection-p: | 539 | `makefile-browser-auto-advance-after-selection-p': |
| 540 | If this variable is set to a non-nil value the cursor | 540 | If this variable is set to a non-nil value the cursor |
| 541 | will automagically advance to the next line after an item | 541 | will automagically advance to the next line after an item |
| 542 | has been selected in the browser. | 542 | has been selected in the browser. |
| 543 | 543 | ||
| 544 | makefile-pickup-everything-picks-up-filenames-p: | 544 | `makefile-pickup-everything-picks-up-filenames-p': |
| 545 | If this variable is set to a non-nil value then | 545 | If this variable is set to a non-nil value then |
| 546 | `makefile-pickup-everything' also picks up filenames as targets | 546 | `makefile-pickup-everything' also picks up filenames as targets |
| 547 | (i.e. it calls `makefile-pickup-filenames-as-targets'), otherwise | 547 | (i.e. it calls `makefile-pickup-filenames-as-targets'), otherwise |
| 548 | filenames are omitted. | 548 | filenames are omitted. |
| 549 | 549 | ||
| 550 | makefile-cleanup-continuations-p: | 550 | `makefile-cleanup-continuations-p': |
| 551 | If this variable is set to a non-nil value then Makefile mode | 551 | If this variable is set to a non-nil value then Makefile mode |
| 552 | will assure that no line in the file ends with a backslash | 552 | will assure that no line in the file ends with a backslash |
| 553 | (the continuation character) followed by any whitespace. | 553 | (the continuation character) followed by any whitespace. |
| @@ -556,11 +556,11 @@ makefile-cleanup-continuations-p: | |||
| 556 | IMPORTANT: Please note that enabling this option causes Makefile mode | 556 | IMPORTANT: Please note that enabling this option causes Makefile mode |
| 557 | to MODIFY A FILE WITHOUT YOUR CONFIRMATION when \"it seems necessary\". | 557 | to MODIFY A FILE WITHOUT YOUR CONFIRMATION when \"it seems necessary\". |
| 558 | 558 | ||
| 559 | makefile-browser-hook: | 559 | `makefile-browser-hook': |
| 560 | A function or list of functions to be called just before the | 560 | A function or list of functions to be called just before the |
| 561 | browser is entered. This is executed in the makefile buffer. | 561 | browser is entered. This is executed in the makefile buffer. |
| 562 | 562 | ||
| 563 | makefile-special-targets-list: | 563 | `makefile-special-targets-list': |
| 564 | List of special targets. You will be offered to complete | 564 | List of special targets. You will be offered to complete |
| 565 | on one of those in the minibuffer whenever you enter a `.'. | 565 | on one of those in the minibuffer whenever you enter a `.'. |
| 566 | at the beginning of a line in Makefile mode." | 566 | at the beginning of a line in Makefile mode." |
| @@ -611,6 +611,9 @@ makefile-special-targets-list: | |||
| 611 | (make-local-variable 'comment-start-skip) | 611 | (make-local-variable 'comment-start-skip) |
| 612 | (setq comment-start-skip "#+[ \t]*") | 612 | (setq comment-start-skip "#+[ \t]*") |
| 613 | 613 | ||
| 614 | ;; Make sure TAB really inserts \t. | ||
| 615 | (set (make-local-variable 'indent-line-function) 'indent-to-left-margin) | ||
| 616 | |||
| 614 | ;; become the current major mode | 617 | ;; become the current major mode |
| 615 | (setq major-mode 'makefile-mode) | 618 | (setq major-mode 'makefile-mode) |
| 616 | (setq mode-name "Makefile") | 619 | (setq mode-name "Makefile") |
| @@ -1055,10 +1058,7 @@ definition and conveniently use this command." | |||
| 1055 | ;; Have a macro assign. Fill just this line, and then backslash | 1058 | ;; Have a macro assign. Fill just this line, and then backslash |
| 1056 | ;; resulting region. | 1059 | ;; resulting region. |
| 1057 | (save-restriction | 1060 | (save-restriction |
| 1058 | (narrow-to-region (point) (save-excursion | 1061 | (narrow-to-region (point) (line-beginning-position 2)) |
| 1059 | (end-of-line) | ||
| 1060 | (forward-char) | ||
| 1061 | (point))) | ||
| 1062 | (let ((fill-paragraph-function nil)) | 1062 | (let ((fill-paragraph-function nil)) |
| 1063 | (fill-paragraph nil)) | 1063 | (fill-paragraph nil)) |
| 1064 | (makefile-backslash-region (point-min) (point-max) nil))))) | 1064 | (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 | |||
| 1185 | large dependencies from the browser to the client buffer. | 1185 | large dependencies from the browser to the client buffer. |
| 1186 | \(point) advances accordingly in the client buffer." | 1186 | \(point) advances accordingly in the client buffer." |
| 1187 | (interactive) | 1187 | (interactive) |
| 1188 | (save-excursion | 1188 | (with-current-buffer makefile-browser-client |
| 1189 | (set-buffer makefile-browser-client) | ||
| 1190 | (end-of-line) | 1189 | (end-of-line) |
| 1191 | (insert "\\\n\t"))) | 1190 | (insert "\\\n\t"))) |
| 1192 | 1191 | ||
| @@ -1451,20 +1450,20 @@ This acts according to the value of `makefile-tab-after-target-colon'." | |||
| 1451 | "Determine if point is on a macro line in the browser." | 1450 | "Determine if point is on a macro line in the browser." |
| 1452 | (save-excursion | 1451 | (save-excursion |
| 1453 | (beginning-of-line) | 1452 | (beginning-of-line) |
| 1454 | (re-search-forward "\\$[{(]" (makefile-end-of-line-point) t))) | 1453 | (re-search-forward "\\$[{(]" (line-end-position) t))) |
| 1455 | 1454 | ||
| 1456 | (defun makefile-browser-this-line-target-name () | 1455 | (defun makefile-browser-this-line-target-name () |
| 1457 | "Extract the target name from a line in the browser." | 1456 | "Extract the target name from a line in the browser." |
| 1458 | (save-excursion | 1457 | (save-excursion |
| 1459 | (end-of-line) | 1458 | (end-of-line) |
| 1460 | (skip-chars-backward "^ \t") | 1459 | (skip-chars-backward "^ \t") |
| 1461 | (buffer-substring (point) (1- (makefile-end-of-line-point))))) | 1460 | (buffer-substring (point) (1- (line-end-position))))) |
| 1462 | 1461 | ||
| 1463 | (defun makefile-browser-this-line-macro-name () | 1462 | (defun makefile-browser-this-line-macro-name () |
| 1464 | "Extract the macro name from a line in the browser." | 1463 | "Extract the macro name from a line in the browser." |
| 1465 | (save-excursion | 1464 | (save-excursion |
| 1466 | (beginning-of-line) | 1465 | (beginning-of-line) |
| 1467 | (re-search-forward "\\$[{(]" (makefile-end-of-line-point) t) | 1466 | (re-search-forward "\\$[{(]" (line-end-position) t) |
| 1468 | (let ((macro-start (point))) | 1467 | (let ((macro-start (point))) |
| 1469 | (skip-chars-forward "^})") | 1468 | (skip-chars-forward "^})") |
| 1470 | (buffer-substring macro-start (point))))) | 1469 | (buffer-substring macro-start (point))))) |
| @@ -1488,21 +1487,11 @@ Uses `makefile-use-curly-braces-for-macros-p'." | |||
| 1488 | (defun makefile-browser-toggle-state-for-line (n) | 1487 | (defun makefile-browser-toggle-state-for-line (n) |
| 1489 | (makefile-browser-set-state-for-line n (not (makefile-browser-get-state-for-line n)))) | 1488 | (makefile-browser-set-state-for-line n (not (makefile-browser-get-state-for-line n)))) |
| 1490 | 1489 | ||
| 1491 | (defun makefile-beginning-of-line-point () | ||
| 1492 | (save-excursion | ||
| 1493 | (beginning-of-line) | ||
| 1494 | (point))) | ||
| 1495 | |||
| 1496 | (defun makefile-end-of-line-point () | ||
| 1497 | (save-excursion | ||
| 1498 | (end-of-line) | ||
| 1499 | (point))) | ||
| 1500 | |||
| 1501 | (defun makefile-last-line-p () | 1490 | (defun makefile-last-line-p () |
| 1502 | (= (makefile-end-of-line-point) (point-max))) | 1491 | (= (line-end-position) (point-max))) |
| 1503 | 1492 | ||
| 1504 | (defun makefile-first-line-p () | 1493 | (defun makefile-first-line-p () |
| 1505 | (= (makefile-beginning-of-line-point) (point-min))) | 1494 | (= (line-beginning-position) (point-min))) |
| 1506 | 1495 | ||
| 1507 | 1496 | ||
| 1508 | 1497 | ||