emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Flyspell, org-mode, and urls
@ 2009-05-28 21:40 Matthew Lundin
  2009-06-03 12:41 ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Lundin @ 2009-05-28 21:40 UTC (permalink / raw)
  To: emacs org-mode mailing list

Hi everyone,

If I might cheat a bit and ask a question that part org-mode, part
another mode....

I have recently begun to use flyspell with org-mode. Everything works
fine, but a minor problem arises when I type a url --- flyspell parses
each element as a normal word, thus resulting in a multi-colored link. I
couldn't find any way of customizing flyspell to exclude certain
regexps.

I noticed that muse mode has a function that prevents urls from being
improperly "colorized."

,----[muse-mode.el:306-315]
| (defun muse-mode-flyspell-p ()
|   "Return non-nil if we should allow spell-checking to occur at point.
| Otherwise return nil.
| 
| This is used to keep links from being improperly colorized by flyspell."
|   (let ((pos (if (bobp) (point) (1- (point)))))
|     (and (not (get-text-property pos 'muse-no-flyspell))
|          (not (get-text-property pos 'muse-link))
|          (save-match-data
|            (null (muse-link-at-point))))))
`----

Would someone happen to know how to accomplish something similar in
org-mode?

Thanks in advance!
- Matt

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Flyspell, org-mode, and urls
  2009-05-28 21:40 Flyspell, org-mode, and urls Matthew Lundin
@ 2009-06-03 12:41 ` Carsten Dominik
  2009-06-03 21:04   ` Matthew Lundin
  0 siblings, 1 reply; 3+ messages in thread
From: Carsten Dominik @ 2009-06-03 12:41 UTC (permalink / raw)
  To: Matthew Lundin; +Cc: emacs org-mode mailing list


On May 28, 2009, at 11:40 PM, Matthew Lundin wrote:

> Hi everyone,
>
> If I might cheat a bit and ask a question that part org-mode, part
> another mode....
>
> I have recently begun to use flyspell with org-mode. Everything works
> fine, but a minor problem arises when I type a url --- flyspell parses
> each element as a normal word, thus resulting in a multi-colored  
> link. I
> couldn't find any way of customizing flyspell to exclude certain
> regexps.
>
> I noticed that muse mode has a function that prevents urls from being
> improperly "colorized."
>
> ,----[muse-mode.el:306-315]
> | (defun muse-mode-flyspell-p ()
> |   "Return non-nil if we should allow spell-checking to occur at  
> point.
> | Otherwise return nil.
> |
> | This is used to keep links from being improperly colorized by  
> flyspell."
> |   (let ((pos (if (bobp) (point) (1- (point)))))
> |     (and (not (get-text-property pos 'muse-no-flyspell))
> |          (not (get-text-property pos 'muse-link))
> |          (save-match-data
> |            (null (muse-link-at-point))))))
> `----
>
> Would someone happen to know how to accomplish something similar in
> org-mode?

We already have the exact same mechanism in place.  The problem is that
flyspell-mode places the overlays *before* org sees that this is a link.
There, a mechanism is needed to actively strip flyspell overlays in
places where this is appropriate.  Muse-mode had this, and so do we now.

Thanks.

- Carsten

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Flyspell, org-mode, and urls
  2009-06-03 12:41 ` Carsten Dominik
@ 2009-06-03 21:04   ` Matthew Lundin
  0 siblings, 0 replies; 3+ messages in thread
From: Matthew Lundin @ 2009-06-03 21:04 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Matthew Lundin, emacs org-mode mailing list

Carsten Dominik <carsten.dominik@gmail.com> writes:

> On May 28, 2009, at 11:40 PM, Matthew Lundin wrote:
>
>> Hi everyone,
>>
>> If I might cheat a bit and ask a question that part org-mode, part
>> another mode....
>>
>> I have recently begun to use flyspell with org-mode. Everything works
>> fine, but a minor problem arises when I type a url --- flyspell parses
>> each element as a normal word, thus resulting in a multi-colored
>> link. I
>> couldn't find any way of customizing flyspell to exclude certain
>> regexps.
>>
>> I noticed that muse mode has a function that prevents urls from being
>> improperly "colorized."
>>
>> ,----[muse-mode.el:306-315]
>> | (defun muse-mode-flyspell-p ()
>> |   "Return non-nil if we should allow spell-checking to occur at
>> point.
>> | Otherwise return nil.
>> |
>> | This is used to keep links from being improperly colorized by
>> flyspell."
>> |   (let ((pos (if (bobp) (point) (1- (point)))))
>> |     (and (not (get-text-property pos 'muse-no-flyspell))
>> |          (not (get-text-property pos 'muse-link))
>> |          (save-match-data
>> |            (null (muse-link-at-point))))))
>> `----
>>
>> Would someone happen to know how to accomplish something similar in
>> org-mode?
>
> We already have the exact same mechanism in place.  The problem is that
> flyspell-mode places the overlays *before* org sees that this is a link.
> There, a mechanism is needed to actively strip flyspell overlays in
> places where this is appropriate.  Muse-mode had this, and so do we now.

Thanks Carsten. It works very well now.

- Matt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-03 21:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-28 21:40 Flyspell, org-mode, and urls Matthew Lundin
2009-06-03 12:41 ` Carsten Dominik
2009-06-03 21:04   ` Matthew Lundin

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).