emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/simple.el


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/simple.el
Date: Thu, 11 Apr 2002 19:44:06 -0400

Index: emacs/lisp/simple.el
diff -c emacs/lisp/simple.el:1.533 emacs/lisp/simple.el:1.534
*** emacs/lisp/simple.el:1.533  Sun Apr  7 06:10:23 2002
--- emacs/lisp/simple.el        Thu Apr 11 19:44:06 2002
***************
*** 2529,2536 ****
        new line-end line-beg)
      (unwind-protect
        (progn
!         (if (not (or (eq last-command 'next-line)
!                      (eq last-command 'previous-line)))
              (setq temporary-goal-column
                    (if (and track-eol (eolp)
                             ;; Don't count beg of empty line as end of line
--- 2529,2535 ----
        new line-end line-beg)
      (unwind-protect
        (progn
!         (if (not (memq last-command '(next-line previous-line)))
              (setq temporary-goal-column
                    (if (and track-eol (eolp)
                             ;; Don't count beg of empty line as end of line
***************
*** 2743,2748 ****
--- 2742,2748 ----
  and drag it forward past ARG other words (backward if ARG negative).
  If ARG is zero, the words around or after point and around or after mark
  are interchanged."
+   ;; FIXME: `foo a!nd bar' should transpose into `bar and foo'.
    (interactive "*p")
    (transpose-subr 'forward-word arg))
  
***************
*** 2751,2757 ****
  Does not work on a sexp that point is in the middle of
  if it is a list or string."
    (interactive "*p")
!   (transpose-subr 'forward-sexp arg))
  
  (defun transpose-lines (arg)
    "Exchange current line and previous line, leaving point after both.
--- 2751,2785 ----
  Does not work on a sexp that point is in the middle of
  if it is a list or string."
    (interactive "*p")
!   (transpose-subr
!    (lambda (arg)
!      ;; Here we should try to simulate the behavior of
!      ;; (cons (progn (forward-sexp x) (point))
!      ;;       (progn (forward-sexp (- x)) (point)))
!      ;; Except that we don't want to rely on the second forward-sexp
!      ;; putting us back to where we want to be, since forward-sexp-function
!      ;; might do funny things like infix-precedence.
!      (if (if (> arg 0)
!            (looking-at "\\sw\\|\\s_")
!          (and (not (bobp))
!               (save-excursion (forward-char -1) (looking-at "\\sw\\|\\s_"))))
!        ;; Jumping over a symbol.  We might be inside it, mind you.
!        (progn (funcall (if (> arg 0)
!                            'skip-syntax-backward 'skip-syntax-forward)
!                        "w_")
!               (cons (save-excursion (forward-sexp arg) (point)) (point)))
!        ;; Otherwise, we're between sexps.  Take a step back before jumping
!        ;; to make sure we'll obey the same precedence no matter which 
direction
!        ;; we're going.
!        (funcall (if (> arg 0) 'skip-syntax-backward 'skip-syntax-forward) " 
.")
!        (cons (save-excursion (forward-sexp arg) (point))
!            (progn (while (or (forward-comment (if (> arg 0) 1 -1))
!                              (not (zerop (funcall (if (> arg 0)
!                                                       'skip-syntax-forward
!                                                     'skip-syntax-backward)
!                                                   ".")))))
!                   (point)))))
!    arg 'special))
  
  (defun transpose-lines (arg)
    "Exchange current line and previous line, leaving point after both.
***************
*** 2940,2948 ****
        ;; Determine where to split the line.
        (let* (after-prefix
               (fill-point
!               (let ((opoint (point))
!                     bounce
!                     (first t))
                  (save-excursion
                    (beginning-of-line)
                    (setq after-prefix (point))
--- 2968,2974 ----
        ;; Determine where to split the line.
        (let* (after-prefix
               (fill-point
!               (let ((opoint (point)))
                  (save-excursion
                    (beginning-of-line)
                    (setq after-prefix (point))
***************
*** 2950,3036 ****
                         (looking-at (regexp-quote fill-prefix))
                         (setq after-prefix (match-end 0)))
                    (move-to-column (1+ fc))
!                   ;; Move back to the point where we can break the line.
!                   ;; We break the line between word or
!                   ;; after/before the character which has character
!                   ;; category `|'.  We search space, \c| followed by
!                   ;; a character, or \c| following a character.  If
!                   ;; not found, place the point at beginning of line.
!                   (while (or first
!                              (and (not (bobp))
!                                   (not bounce)
!                                   (fill-nobreak-p)))
!                     (setq first nil)
!                     (re-search-backward "[ \t]\\|\\c|.\\|.\\c|\\|^")
!                     ;; If we find nowhere on the line to break it,
!                     ;; break after one word.  Set bounce to t
!                     ;; so we will not keep going in this while loop.
!                     (if (<= (point) after-prefix)
!                         (progn
!                           (goto-char after-prefix)
!                           (re-search-forward "[ \t]" opoint t)
!                           (setq bounce t))
!                       (if (looking-at "[ \t]")
!                           ;; Break the line at word boundary.
!                           (skip-chars-backward " \t")
!                         ;; Break the line after/before \c|.
!                         (forward-char 1))))
!                   (if enable-multibyte-characters
!                       ;; If we are going to break the line after or
!                       ;; before a non-ascii character, we may have
!                       ;; to run a special function for the charset
!                       ;; of the character to find the correct break
!                       ;; point.
!                       (if (not (and (eq (charset-after (1- (point))) 'ascii)
!                                     (eq (charset-after (point)) 'ascii)))
!                           (fill-find-break-point after-prefix)))
! 
!                   ;; Let fill-point be set to the place where we end up.
!                   ;; But move back before any whitespace here.
!                   (skip-chars-backward " \t")
                    (point)))))
  
          ;; See whether the place we found is any good.
          (if (save-excursion
                (goto-char fill-point)
!               (and (not (bolp))
!                    ;; There is no use breaking at end of line.
!                    (not (save-excursion (skip-chars-forward " ") (eolp)))
!                    ;; It is futile to split at the end of the prefix
!                    ;; since we would just insert the prefix again.
!                    (not (and after-prefix (<= (point) after-prefix)))
!                    ;; Don't split right after a comment starter
!                    ;; since we would just make another comment starter.
!                    (not (and comment-start-skip
!                              (let ((limit (point)))
!                                (beginning-of-line)
!                                (and (re-search-forward comment-start-skip
!                                                        limit t)
!                                     (eq (point) limit)))))))
!             ;; Ok, we have a useful place to break the line.  Do it.
!             (let ((prev-column (current-column)))
!               ;; If point is at the fill-point, do not `save-excursion'.
!               ;; Otherwise, if a comment prefix or fill-prefix is inserted,
!               ;; point will end up before it rather than after it.
!               (if (save-excursion
!                     (skip-chars-backward " \t")
!                     (= (point) fill-point))
!                   (funcall comment-line-break-function t)
                  (save-excursion
-                   (goto-char fill-point)
-                   (funcall comment-line-break-function t)))
-               ;; Now do justification, if required
-               (if (not (eq justify 'left))
-                   (save-excursion
                    (end-of-line 0)
                    (justify-current-line justify nil t)))
!               ;; If making the new line didn't reduce the hpos of
!               ;; the end of the line, then give up now;
!               ;; trying again will not help.
!               (if (>= (current-column) prev-column)
!                   (setq give-up t)))
!           ;; No good place to break => stop trying.
!           (setq give-up t))))
        ;; Justify last line.
        (justify-current-line justify t t)
        t)))
--- 2976,3025 ----
                         (looking-at (regexp-quote fill-prefix))
                         (setq after-prefix (match-end 0)))
                    (move-to-column (1+ fc))
!                   (fill-move-to-break-point after-prefix)
                    (point)))))
  
          ;; See whether the place we found is any good.
          (if (save-excursion
                (goto-char fill-point)
!               (or (bolp)
!                   ;; There is no use breaking at end of line.
!                   (save-excursion (skip-chars-forward " ") (eolp))
!                   ;; It is futile to split at the end of the prefix
!                   ;; since we would just insert the prefix again.
!                   (and after-prefix (<= (point) after-prefix))
!                   ;; Don't split right after a comment starter
!                   ;; since we would just make another comment starter.
!                   (and comment-start-skip
!                        (let ((limit (point)))
!                          (beginning-of-line)
!                          (and (re-search-forward comment-start-skip
!                                                  limit t)
!                               (eq (point) limit))))))
!             ;; No good place to break => stop trying.
!             (setq give-up t)
!           ;; Ok, we have a useful place to break the line.  Do it.
!           (let ((prev-column (current-column)))
!             ;; If point is at the fill-point, do not `save-excursion'.
!             ;; Otherwise, if a comment prefix or fill-prefix is inserted,
!             ;; point will end up before it rather than after it.
!             (if (save-excursion
!                   (skip-chars-backward " \t")
!                   (= (point) fill-point))
!                 (funcall comment-line-break-function t)
!               (save-excursion
!                 (goto-char fill-point)
!                 (funcall comment-line-break-function t)))
!             ;; Now do justification, if required
!             (if (not (eq justify 'left))
                  (save-excursion
                    (end-of-line 0)
                    (justify-current-line justify nil t)))
!             ;; If making the new line didn't reduce the hpos of
!             ;; the end of the line, then give up now;
!             ;; trying again will not help.
!             (if (>= (current-column) prev-column)
!                 (setq give-up t))))))
        ;; Justify last line.
        (justify-current-line justify t t)
        t)))
***************
*** 4077,4110 ****
      (clone-indirect-buffer nil t norecord)))
  
  (define-key ctl-x-4-map "c" 'clone-indirect-buffer-other-window)
- 
- 
- ;;; Syntax stuff.
- 
- (defconst syntax-code-table
-     '((?\ 0 "whitespace")
-       (?- 0 "whitespace")
-       (?. 1 "punctuation")
-       (?w 2 "word")
-       (?_ 3 "symbol")
-       (?\( 4 "open parenthesis")
-       (?\) 5 "close parenthesis")
-       (?\' 6 "expression prefix")
-       (?\" 7 "string quote")
-       (?$ 8 "paired delimiter")
-       (?\\ 9 "escape")
-       (?/ 10 "character quote")
-       (?< 11 "comment start")
-       (?> 12 "comment end")
-       (?@ 13 "inherit")
-       (nil 14 "comment fence")
-       (nil 15 "string fence"))
-     "Alist of forms (CHAR CODE DESCRIPTION) mapping characters to syntax info.
- CHAR is a character that is allowed as first char in the string
- specifying the syntax when calling `modify-syntax-entry'.  CODE is the
- corresponing syntax code as it is stored in a syntax cell, and
- can be used as value of a `syntax-table' property.
- DESCRIPTION is the descriptive string for the syntax.")
  
  
  ;;; Handling of Backspace and Delete keys.
--- 4066,4071 ----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]