[Top][All Lists]

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

Re: table-recognize and default-major-mode

From: Dr Roland Winkler
Subject: Re: table-recognize and default-major-mode
Date: Thu, 4 Aug 2005 20:27:23 +0200

On Mon Aug 1 2005 Richard M. Stallman wrote:
>     Up to now I had overlooked that table-recognize actually issues a
>     message in the message area "Recognizing tables...done". This
>     message is always issued when I load a file, suggesting that this
>     function is always evaluated. But somehow, table-recognize has no
>     effect.
> I suggest that you (1) try to debug this and (2) ask the developer
> of table.el to help.

It seems to me that the problem is not a bug of table.el. But it is
a more general problem of how default-major-mode works.

The function table-recognize sets some text properties for some part
of a buffer. It seems that any function which sets text properties,
does not work properly with default-major-mode.

To be more specific, start emacs --no-init-file and load the
following piece of code which does not require table.el.

(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'foo-highlight)
(defun foo-highlight ()
  "Highlight all occurences of string \"foo\"."
    (goto-char (point-min))
    (while (re-search-forward "foo" nil t)
      (put-text-property (match-beginning 0) (match-end 0)
                         'face 'highlight))
    (set-buffer-modified-p nil)))

Then visit file "foo" or "foo.txt".

cat > foo <<EOF
foo bar foo bar foo bar
cat > foo.txt <<EOF
foo bar foo bar foo bar

foo-highlight highlights all occurences of the string "foo" in the
buffer visiting foo.txt, but it doesn't do that for the buffer
visiting file foo.

Unfortunately, I am really not familiar with the emacs internals of
how files are visited. I hope that someone else can fix this bug.

Thanks a lot,


reply via email to

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