emacs-devel
[Top][All Lists]
Advanced

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

Re: line-line-move-visual: was line motion problem


From: Vinicius Jose Latorre
Subject: Re: line-line-move-visual: was line motion problem
Date: Mon, 21 Jul 2008 20:05:22 -0300
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.15) Gecko/20080620 SeaMonkey/1.1.10

David Reitter wrote:
On 21 Jul 2008, at 00:49, Chong Yidong wrote:
If anyone on this list has a patch that is still waiting for approval or
further comments, now would be a good time to ping.


OK, there is still the paragraph marking function. The following two major items (and some smaller issues) have been addressed:

Stefan Monnier:

My font doesn't seem to know the char 2230, and UnicodeData.txt doesn't
seem to know that char either. So we should probably use something else.

On 18 Jul 2008, at 11:30, Dan Nicolaescu wrote:

whitespace.el already has many many ways of dealing with whitespaces,
wouldn't this mode be a better fit in whitespace.el?


Any objections to the patch below.
Can't put it in simple.el because make-glyph-code can't be autoloaded, and the code is probably happy in whitespace.el.

- D


I have objections to this patch.


*** whitespace.el    06 May 2008 03:57:59 -0400    1.80
--- whitespace.el 21 Jul 2008 11:04:45 -0400 ***************
*** 2352,2357 ****
--- 2352,2406 ----
        (whitespace-mode -1)))
    nil)                    ; continue standard unloading

+ 
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+
+ ;; Show-newlines-mode
+ (defface blank-newline
+  '((((class color) (background dark))
+     (:foreground "lightgrey" :bold nil))
+    (((class color) (background light))
+     ( :foreground "lightgrey" :bold nil))
+    (t (:bold nil :underline t)))
+  "Face used to visualize NEWLINE char mapping.
+
+ See `blank-display-mappings'."
+  :group 'blank)

First of all, there is no more blank package, it was replaced by whitespace package.

Second, there is already whitespace-newline which is the face used to visualize newlines.


+
+ (defvar show-newlines-newline-code
+   (vector (make-glyph-code 182 'blank-newline) 10))

No need for this, please, see whitespace-display-mappings option documentation.


+
+ ;;;###autoload
+ (define-minor-mode show-newlines-mode
+   "Mark newlines in current buffer"
+   :group 'convenience
+
+   (unless buffer-display-table
+     (setq buffer-display-table
+       (or standard-display-table (make-display-table))))
+   (aset buffer-display-table 10
+     (if show-newlines-mode show-newlines-newline-code)))
+
+ ;;;###autoload
+ (define-minor-mode global-show-newlines-mode
+  "Mark newlines in all buffers"
+  :group 'convenience
+  :global t
+
+  (unless standard-display-table
+    (setq standard-display-table (make-display-table)))
+  (if global-show-newlines-mode
+      (aset standard-display-table 10 show-newlines-newline-code)
+    (aset standard-display-table 10 nil))
+  (dolist (buffer (buffer-list))
+    (with-current-buffer buffer
+      (if buffer-display-table
+      (show-newlines-mode
+       (if global-show-newlines-mode 1 -1))))))
+
+

  (provide 'whitespace)

Again, no need for all of these functions.

If it is necessary to have specific functions to display newlines, it should be something like this:

(defun whitespace-newline ()
   (let ((whitespace-style '(newline-mark newline)))
      (whitespace-mode 1)))

(defun global-whitespace-newline ()
   (let ((whitespace-style '(newline-mark newline)))
      (global-whitespace-mode 1)))



*** menu-bar.el    10 Jul 2008 00:27:23 -0400    1.341
--- menu-bar.el 21 Jul 2008 11:45:01 -0400 ***************
*** 653,659 ****
    (let ((need-save nil))
      ;; These are set with menu-bar-make-mm-toggle, which does not
      ;; put on a customized-value property.
! (dolist (elt '(line-number-mode column-number-mode size-indication-mode
             cua-mode show-paren-mode transient-mark-mode
             blink-cursor-mode display-time-mode display-battery-mode))
        (and (customize-mark-to-save elt)
--- 653,660 ----
    (let ((need-save nil))
      ;; These are set with menu-bar-make-mm-toggle, which does not
      ;; put on a customized-value property.
!     (dolist (elt '(global-show-newlines-mode line-number-mode
!            column-number-mode size-indication-mode
             cua-mode show-paren-mode transient-mark-mode
             blink-cursor-mode display-time-mode display-battery-mode))
        (and (customize-mark-to-save elt)
***************
*** 700,705 ****
--- 701,714 ----

  (defvar menu-bar-showhide-menu (make-sparse-keymap "Show/Hide"))

+ (define-key menu-bar-showhide-menu [show-newlines-mode]
+  (menu-bar-make-mm-toggle global-show-newlines-mode
+                "Show Newlines"
+                "Show hard newlines"))
+
+ (define-key menu-bar-showhide-menu [newlines-separator]
+   '("--"))
+
  (define-key menu-bar-showhide-menu [column-number-mode]
    (menu-bar-make-mm-toggle column-number-mode
                 "Column Numbers"

Why should the newline visualization be inserted into menu-bar?


Vinicius





reply via email to

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