all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* next-property-change error
@ 2009-08-21 14:58 Xavier Sanchez
  2009-08-21 15:15 ` Joost Kremers
  2009-08-22 15:16 ` Drew Adams
  0 siblings, 2 replies; 3+ messages in thread
From: Xavier Sanchez @ 2009-08-21 14:58 UTC (permalink / raw)
  To: help-gnu-emacs

Hello all,

I'm writing an html to LaTeX program in elisp that includes the
following function:

(defun xhtlatex-href ()
  (re-search-forward "=[\"'\n]*" nil t)
  (let ((url (buffer-substring (point) (next-property-change
(point)))))
    (sgml-skip-tag-forward 1)
    (insert "}")
    (sgml-skip-tag-backward 1)
    (sgml-delete-tag 1)
    (insert (concat "\\href{" url "}{"))))

There's another function that finds the "<a", then calls the above
function if "href" follows.
When I load the file and run the program the first time it stops at
the "<a" and gives the error:

let: Wrong type argument: integer-or-marker-p, nil

This only happens once; subsequent runs work as expected.

For what it's worth, I've found that doing a minibuffer evaluation of
(next-property-change (point)) at some point in the buffer before the
first run of the program enables execution up to that point.

I haven't made sense of this yet, can anyone else?

Thanks


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

* Re: next-property-change error
  2009-08-21 14:58 next-property-change error Xavier Sanchez
@ 2009-08-21 15:15 ` Joost Kremers
  2009-08-22 15:16 ` Drew Adams
  1 sibling, 0 replies; 3+ messages in thread
From: Joost Kremers @ 2009-08-21 15:15 UTC (permalink / raw)
  To: help-gnu-emacs

Xavier Sanchez wrote:
[...]
> When I load the file and run the program the first time it stops at
> the "<a" and gives the error:
>
> let: Wrong type argument: integer-or-marker-p, nil
>
> This only happens once; subsequent runs work as expected.

read the documentation for the function next-property-change and pay special
attention to the return value.


-- 
Joost Kremers                                      joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


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

* RE: next-property-change error
  2009-08-21 14:58 next-property-change error Xavier Sanchez
  2009-08-21 15:15 ` Joost Kremers
@ 2009-08-22 15:16 ` Drew Adams
  1 sibling, 0 replies; 3+ messages in thread
From: Drew Adams @ 2009-08-22 15:16 UTC (permalink / raw)
  To: 'Xavier Sanchez', help-gnu-emacs

> (defun xhtlatex-href ()
>   (re-search-forward "=[\"'\n]*" nil t)
>   (let ((url (buffer-substring (point) (next-property-change
> (point)))))
>     (sgml-skip-tag-forward 1)
>     (insert "}")
>     (sgml-skip-tag-backward 1)
>     (sgml-delete-tag 1)
>     (insert (concat "\\href{" url "}{"))))
> 
> There's another function that finds the "<a", then calls the above
> function if "href" follows.
> When I load the file and run the program the first time it stops at
> the "<a" and gives the error:
> 
> let: Wrong type argument: integer-or-marker-p, nil
> 
> This only happens once; subsequent runs work as expected.
> 
> For what it's worth, I've found that doing a minibuffer evaluation of
> (next-property-change (point)) at some point in the buffer before the
> first run of the program enables execution up to that point.
> 
> I haven't made sense of this yet, can anyone else?

Probably (next-property-change (point)) is returning nil the first time through
(there is no next property change), so `buffer-substring' complains that its
second arg is nil, not an integer or a marker.





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

end of thread, other threads:[~2009-08-22 15:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-21 14:58 next-property-change error Xavier Sanchez
2009-08-21 15:15 ` Joost Kremers
2009-08-22 15:16 ` Drew Adams

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.