Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Need Help on Whitespace-mode in Emacs 24.1.1
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  11 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Fan  
View profile  
 More options Aug 25 2012, 11:15 pm
Newsgroups: gnu.emacs.help
From: Fan <gnu.emacs....@gmail.com>
Date: Sat, 25 Aug 2012 20:15:48 -0700 (PDT)
Local: Sat, Aug 25 2012 11:15 pm
Subject: Need Help on Whitespace-mode in Emacs 24.1.1
Hi

I had the following lines in my ~/.emacs and the whitespace mode worked fine in Emacs 23.1.1 previously.

  (message "Enabling whitespace mode ...")
  (require 'whitespace)
  (set-face-background 'whitespace-tab "lime green")
  (setq-default whitespace-style '(tabs trailing))
  (global-whitespace-mode t)
  (message "Enabled whitespace mode.")

However, when I switched to Emacs 24.1.1, the whitespace mode no longer worked.  It won't highlight, even if I tried exec whitespace-mode to toggle it on and off again.

From reading help on whitespace-style variable, it appears both 'tabs & 'trailing now also require 'face, i.e.

  (setq-default whitespace-style '(face tabs trailing))

When I tested by eval it and followed by exec whitespace-mode interactively, it worked.

BTW, somehow, the mode line now shows my buffer has both WS major mode & ws minor mode after exec whitespace-mode.  Why are there 2 whitespace modes?  Previously, whitespace works with just only WS major mode in Emacs 23.1.1.

I then replaced the old whitespace-style line with the above line in my ~/.emacs.

Unfortunately, when I tried to start a new Emacs session, it failed to open properly.  Here are the contents displayed in *Warnings* and *Messages* buffers.

In *Warnings* buffer:

  Warning (initialization): An error occurred while loading `/home/.emacs':

  Symbol's value as variable is void: font-lock-defaults-alist

  To ensure normal operation, you should investigate and remove the
  cause of the error in your initialization file.  Start Emacs with
  the `--debug-init' option to view a complete error backtrace.

In *Messages* buffer:

  Enabling whitespace mode ...
  let: Symbol's value as variable is void: font-lock-defaults-alist
  Error in post-command-hook (global-font-lock-mode-check-buffers): (void-variable font-lock-defaults-alist)

I'm clueless to what went wrong, and how to debug.  Please help.

If setting whitespace-style variable interactively worked, why would it fail when set in ~/.emacs?  Is there something else I need to set to get whitespace mode working in Emacs 24.1.1?

Thanks for your help in advance.

Fan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Dyballa  
View profile  
 More options Aug 26 2012, 4:17 am
Newsgroups: gnu.emacs.help
From: Peter Dyballa <Peter_Dyba...@Web.DE>
Date: Sun, 26 Aug 2012 10:17:49 +0200
Local: Sun, Aug 26 2012 4:17 am
Subject: Re: Need Help on Whitespace-mode in Emacs 24.1.1

Am 26.08.2012 um 05:15 schrieb Fan:

> In *Warnings* buffer:

>  Warning (initialization): An error occurred while loading `/home/.emacs':

>  Symbol's value as variable is void: font-lock-defaults-alist

This is the actual error! When I have your seven lines

        (message "Enabling whitespace mode ...")
        (require 'whitespace)
        (set-face-background 'whitespace-tab "lime green")
        (setq-default whitespace-style '(tabs trailing))
        (global-whitespace-mode t)
        (message "Enabled whitespace mode.")
        (setq-default whitespace-style '(face tabs trailing))

in my .emacs it launches and works correctly, including only one "WS" in the mode-line. Obviously later in your init file something tries to manipulate the variable font-lock-defaults-alist which does not exist in GNU Emacs 24. First correct this error!

--
Greetings

  Pete       (:
        _    / __    -    -
      _/ \__/_/        -     -
     (´`)      (´`)   -    -
      `´        `´


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fan  
View profile  
 More options Aug 26 2012, 10:46 am
Newsgroups: gnu.emacs.help
From: Fan <gnu.emacs....@gmail.com>
Date: Sun, 26 Aug 2012 07:46:19 -0700 (PDT)
Local: Sun, Aug 26 2012 10:46 am
Subject: Re: Need Help on Whitespace-mode in Emacs 24.1.1

On Sunday, August 26, 2012 3:17:49 AM UTC-5, Peter Dyballa wrote:

> in my .emacs it launches and works correctly, including only one "WS" in the mode-line. Obviously later in your init file something tries to manipulate the variable font-lock-defaults-alist which does not exist in GNU Emacs 24. First correct this error!

Hi Pete

Using process of elimination, I finally locate the offending line in my "long" ~/.emacs. :)

  (require 'font-menus)

Can you add it to your ~/.emacs and see if you can replicate the same problem I encountered earlier?

If I recall correctly, it was added to my ~/.emacs way back when using in Emacs 21.1.

It seems that combination of the 3 below can't co-exist.

  Emacs 24.1.1
  (require 'font-menus)
  (setq-default whitespace-style '(face tabs trailing))

However, any combinations of any 2 of the 3 above are OK.

BTW, I can live without font-menus if I have to choose between it and whitespace-mode.  But, it'll be nice if I can have both.

Thanks.

Fan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Dyballa  
View profile  
 More options Aug 26 2012, 11:04 am
Newsgroups: gnu.emacs.help
From: Peter Dyballa <Peter_Dyba...@Web.DE>
Date: Sun, 26 Aug 2012 17:04:02 +0200
Local: Sun, Aug 26 2012 11:04 am
Subject: Re: Need Help on Whitespace-mode in Emacs 24.1.1

Am 26.08.2012 um 16:46 schrieb Fan:

>  (require 'font-menus)

> Can you add it to your ~/.emacs and see if you can replicate the same problem I encountered earlier?

I have no font-menus related Elisp file. This is not part of GNU Emacs. It must be some old stuff you keep. Locate the file and check why and how it uses font-lock-defaults-alist. Then write its author about that. Maybe he or she has an updated version.

--
Greetings

  Pete

Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.
                                – Albert Einstein


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Drew Adams  
View profile  
 More options Aug 26 2012, 11:17 am
Newsgroups: gnu.emacs.help
From: "Drew Adams" <drew.ad...@oracle.com>
Date: Sun, 26 Aug 2012 08:17:02 -0700
Local: Sun, Aug 26 2012 11:17 am
Subject: RE: Need Help on Whitespace-mode in Emacs 24.1.1

> Using process of elimination, I finally locate the offending
> line in my "long" ~/.emacs. :)
>   (require 'font-menus)

Funny you should hapen to post this just now.

I am in the process of fixing up font-menus.el so it works with Emacs 24.  The
problem is that it uses `font-lock-defaults-alist' which has just been removed
from Emacs.  (On n'arrete pas le progres.)

Because there are existing copies of font-menus.el out there, which will not
benefit from the fix, I am giving my fixed version a new name,
`font-menus-da.el'.  If Francis J. Wright (the author) incorporates a fix to the
original file then I will toss my fixed version.

I've just posted my version on Emacs Wiki, as font-menus-da.el.  But I will
probably tweak it a bit more today.  You need only (require 'font-menus), as
before, since the new version still provides that same feature.

http://www.emacswiki.org/emacs/download/font-menus-da.el


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Dyballa  
View profile  
 More options Aug 26 2012, 11:57 am
Newsgroups: gnu.emacs.help
From: Peter Dyballa <Peter_Dyba...@Web.DE>
Date: Sun, 26 Aug 2012 17:57:03 +0200
Local: Sun, Aug 26 2012 11:57 am
Subject: Re: Need Help on Whitespace-mode in Emacs 24.1.1

Am 26.08.2012 um 17:17 schrieb Drew Adams:

> I've just posted my version on Emacs Wiki, as font-menus-da.el.  But I will
> probably tweak it a bit more today.

The output is a list of XLFD names – do they enable GNU Emacs 24 to load these fonts via libfontconfig (and not via the X server), apply libotf and libm17n-* to get full font support and complex type layout? If not, than the fontconfig names (and features as if from fc-list/fc-match) would be a better choice.

And another output could be possible, that from this function by Miles Bader:

;;; ----------------------------------------------------------------
;;; list-fonts-display via font-config
(defun list-fonts-display (&optional matching)
     "Display a list of font-families available via font-config, in a new buffer.
   If the optional argument MATCHING is non-nil, only font families
   matching that regexp are displayed; interactively, a prefix
   argument will prompt for the regexp.
   The name of each font family is displayed using that family, as
   well as in the default font (to handle the case where a font
   cannot be used to display its own name)."
     (interactive
      (list
       (and current-prefix-arg
            (read-string "Display font families matching regexp: "))))
     (let (families)
       (with-temp-buffer
         (shell-command "fc-list : family" t)
         (goto-char (point-min))
         (while (not (eobp))
           (let ((fam (buffer-substring (line-beginning-position)
                                        (line-end-position))))
             (when (or (null matching) (string-match matching fam))
               (push fam families)))
           (forward-line)))
       (setq families
             (sort families
                   (lambda (x y) (string-lessp (downcase x) (downcase y)))))
       (let ((buf (get-buffer-create "*Font Families*")))
         (with-current-buffer buf
           (erase-buffer)
           (dolist (family families)
             ;; We need to pick one of the comma-separated names to
             ;; actually use the font; choose the longest one because some
             ;; fonts have ambiguous general names as well as specific
             ;; ones.
             (let ((family-name
                    (car (sort (split-string family ",")
                               (lambda (x y) (> (length x) (length y))))))
                   (nice-family (replace-regexp-in-string "," ", " family)))
               (insert (concat (propertize nice-family
                                           'face (list :family family-name))
                               " (" nice-family ")"))
               (newline)))
           (goto-char (point-min)))
         (display-buffer buf))))
;; --------------------------------------------------------

--
Greetings

  Pete

No project was ever completed on time and within budget.
                                – Cheops Law


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Drew Adams  
View profile  
 More options Aug 26 2012, 12:20 pm
Newsgroups: gnu.emacs.help
From: "Drew Adams" <drew.ad...@oracle.com>
Date: Sun, 26 Aug 2012 09:20:32 -0700
Local: Sun, Aug 26 2012 12:20 pm
Subject: RE: Need Help on Whitespace-mode in Emacs 24.1.1

> > I've just posted my version on Emacs Wiki, as
> > font-menus-da.el.  But I will probably tweak it a bit more today.

> The output is a list of XLFD names - do they enable GNU Emacs 24

What is "they"?

> to load these fonts via libfontconfig (and not via the X
> server), apply libotf and libm17n-* to get full font support
> and complex type layout? If not, than the fontconfig names
> (and features as if from fc-list/fc-match) would be a better choice.

Sorry, I have no idea what you are asking.

Are you asking about the font display from `font-menus.el'?  If so, I have not
changed that at all.  This is the kind of thing that shows:

-outline-Andale Mono-normal-normal-normal-mono-*-*-*-*-c-*-iso10646-1
-outline-Andale Mono-normal-normal-normal-mono-*-*-*-*-c-*-iso8859-1
-outline-Andale Mono-normal-normal-normal-mono-*-*-*-*-c-*-iso8859-2
-outline-Andale Mono-normal-normal-normal-mono-*-*-*-*-c-*-iso8859-4
-outline-Andale Mono-normal-normal-normal-mono-*-*-*-*-c-*-iso8859-5
-outline-Andale Mono-normal-normal-normal-mono-*-*-*-*-c-*-iso8859-7
-outline-Andale Mono-normal-normal-normal-mono-*-*-*-*-c-*-iso8859-9
-outline-Arial Black-normal-italic-normal-sans-*-*-*-*-p-*-iso10646-1
-outline-Arial Black-normal-italic-normal-sans-*-*-*-*-p-*-iso8859-1
-outline-Arial Black-ultra-bold-normal-normal-sans-*-*-*-*-p-*-iso10646-1
-outline-Arial Black-ultra-bold-normal-normal-sans-*-*-*-*-p-*-iso8859-1
-outline-Arial Black-ultra-bold-normal-normal-sans-*-*-*-*-p-*-iso8859-2
-outline-Arial Black-ultra-bold-normal-normal-sans-*-*-*-*-p-*-iso8859-4
...

> And another output could be possible, that from this function
> by Miles Bader:

I happen to use Mile's function also.  That shows a much shorter list of fonts,
and it shows only the font names.  But the names are shown using their own fonts
(WYSIWYG):

Bitstream Charter (Bitstream Charter)
Bitstream Vera Sans (Bitstream Vera Sans)
Bitstream Vera Sans Mono (Bitstream Vera Sans Mono)
Bitstream Vera Serif (Bitstream Vera Serif)
Charter (Charter)
Clean (Clean)
ClearlyU (ClearlyU)
ClearlyU Alternate Glyphs (ClearlyU Alternate Glyphs)
ClearlyU PUA (ClearlyU PUA)
Courier (Courier)
...

Two different critters, serving different purposes.

Again, dunno what you are asking (or whom you are asking).


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Drew Adams  
View profile  
 More options Aug 26 2012, 12:22 pm
Newsgroups: gnu.emacs.help
From: "Drew Adams" <drew.ad...@oracle.com>
Date: Sun, 26 Aug 2012 09:22:02 -0700
Local: Sun, Aug 26 2012 12:22 pm
Subject: RE: Need Help on Whitespace-mode in Emacs 24.1.1

> I happen to use Mile's function also.  That shows a much
> shorter list of fonts, and it shows only the font names.

I meant font family names, here.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fan  
View profile  
 More options Aug 26 2012, 6:45 pm
Newsgroups: gnu.emacs.help
From: Fan <gnu.emacs....@gmail.com>
Date: Sun, 26 Aug 2012 15:45:11 -0700 (PDT)
Local: Sun, Aug 26 2012 6:45 pm
Subject: Re: Need Help on Whitespace-mode in Emacs 24.1.1

On Sunday, August 26, 2012 10:17:02 AM UTC-5, Drew Adams wrote:

> I've just posted my version on Emacs Wiki, as font-menus-da.el.  But I will
> probably tweak it a bit more today.  You need only (require 'font-menus), as
> before, since the new version still provides that same feature.

> http://www.emacswiki.org/emacs/download/font-menus-da.el

Thanks, Drew.  It works like a charm.  I now can have my cake and eat it too. :)

Fan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Drew Adams  
View profile  
 More options Aug 26 2012, 6:54 pm
Newsgroups: gnu.emacs.help
From: "Drew Adams" <drew.ad...@oracle.com>
Date: Sun, 26 Aug 2012 15:54:46 -0700
Local: Sun, Aug 26 2012 6:54 pm
Subject: RE: Need Help on Whitespace-mode in Emacs 24.1.1

> > http://www.emacswiki.org/emacs/download/font-menus-da.el

> Thanks, Drew.  It works like a charm.  I now can have my cake
> and eat it too. :)

Hm.  I don't think it works like a charm yet.  So far, what I uploaded does not
work with recent Emacs versions (at least on Windows).  But I will soon upload
something that does work.  So stay tuned.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Drew Adams  
View profile  
 More options Aug 26 2012, 7:31 pm
Newsgroups: gnu.emacs.help
From: "Drew Adams" <drew.ad...@oracle.com>
Date: Sun, 26 Aug 2012 16:31:08 -0700
Local: Sun, Aug 26 2012 7:31 pm
Subject: RE: Need Help on Whitespace-mode in Emacs 24.1.1

> > > http://www.emacswiki.org/emacs/download/font-menus-da.el

> > Thanks, Drew.  It works like a charm.  I now can have my cake
> > and eat it too. :)

> Hm.  I don't think it works like a charm yet.  So far, what I
> uploaded does not work with recent Emacs versions (at least on
> Windows).  But I will soon upload something that does work.
> So stay tuned.

FYI - Should be OK now.

---

La petite histoire -

Font lock has changed a _lot_ since Emacs 21 (the last version for which this
code really worked, until now).

Among other things, in recent Emacs versions, `font-lock-set-defaults', the
function that is advised here, is called a zillion times when you turn on
font-locking, and most of those calls are in places outside the context that
should be advised here (i.e., within function `font-lock-fontify-level').

The result was that you could go down font-lock levels but you could not go back
up.  `font-lock-set-menu' was getting called (many times) outside the context
where `font-lock-maximum-decoration' was bound to the new level, so the level
was being treated as if it were `t' (maximum).

In Emacs 20/21, `font-lock-set-menu' was called only once.  Now it is called
many times in the course of switching levels (once).  Even by doing nothing for
most of those calls (since they are outside `font-lock-fontify-level', I make
them no-ops), it is still the case that the code gets repeated three times
(IIRC).  Not a big deal, but no doubt a slight waste.  At least it works again.

---

BTW, as I tried to explain on emacs-devel today, you need not treat the
so-called "levels" as levels of an amount of highlighting.  You can treat them
as just different highlighting patterns (not necessarily more or less
highlighting).

IOW, you can cycle among "levels" 1, 2, 3, etc., but that need not mean
increasing or decreasing the amount of highlighting.  Think of the 1, 2, 3, etc.
the way you would think of switching among desktops or window configurations
that are numbered 1, 2, 3, etc.: they're just alternatives you can choose.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »