GNU bug report logs - #13585
pascal-mode doesn't recognize all free-pascal comments

Previous Next

Package: emacs;

Reported by: vrt277 <vrt277 <at> gmail.com>

Date: Tue, 29 Jan 2013 16:05:03 UTC

Severity: normal

Fixed in version 24.4

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13585 in the body.
You can then email your comments to 13585 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#13585; Package emacs. (Tue, 29 Jan 2013 16:05:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to vrt277 <vrt277 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 29 Jan 2013 16:05:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: vrt277 <vrt277 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: pascal-mode doesn't recognize all free-pascal comments
Date: Wed, 30 Jan 2013 00:09:42 +1100
Hi Emacs developers,

pascal-mode from pascal.el doesn't recognize c-style (aka delphi style)
one-line comments.

==example

// I'm a comment

==example

One-line comments is widely used in delphi/freepascal code. Examples can
be found in freepascal compiler sources (for example
https://github.com/graemeg/freepascal/blob/master/compiler/nflw.pas#L848).
(Most ugly thing is that apostrophe symbol inside comment will be 
recognized
as start of string and source code below will be highlighted as
string).
Information about freepascal comments can be found here:
http://www.freepascal.org/docs-html/ref/refse2.html

Nowday freepascal is one of most widely used pascal compilers (after
Delphi). Although delphi-mode doesn't have
described problem I thiks if there is separate pascal-mode it should work
good. So problem should be fixed.

Thanks,
Vasiliy K.

In GNU Emacs 24.1.1 (i686-pc-linux-gnu, GTK+ Version 2.24.12)
of 2012-09-23 on panlong, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11300000
Configured using:
`configure '--build' 'i686-linux-gnu' '--build' 'i686-linux-gnu'
'--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
'--localstatedir=/var/lib' '--infodir=/usr/share/info'
'--mandir=/usr/share/man' '--with-pop=yes'
'--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.1/site-lisp:/usr/share/emacs/site-lisp' 

'--with-crt-dir=/usr/lib/i386-linux-gnu' '--with-x=yes'
'--with-x-toolkit=gtk' '--with-toolkit-scroll-bars'
'build_alias=i686-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
--param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -O2'
'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: nil
locale-coding-system: utf-8-unix
default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
tooltip-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t

Recent input:
M-x s e n d - e m a <tab> <backspace> <backspace> <backspace>
<M-backspace> r e p o r <tab> <return>

Recent messages:
Loading 00debian-vars...done
Loading /etc/emacs/site-start.d/50autoconf.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el 
(source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el 
(source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
/usr/share/emacs/24.1/site-lisp/debian-startup hides 
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides 
/usr/share/emacs/24.1/lisp/textmodes/flyspell
/usr/share/emacs24/site-lisp/dictionaries-common/ispell hides 
/usr/share/emacs/24.1/lisp/textmodes/ispell

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail regexp-opt rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils time-date tooltip ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty emacs)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13585; Package emacs. (Thu, 31 Jan 2013 01:04:02 GMT) Full text and rfc822 format available.

Message #8 received at 13585 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: vrt277 <vrt277 <at> gmail.com>
Cc: 13585 <at> debbugs.gnu.org
Subject: Re: bug#13585: pascal-mode doesn't recognize all free-pascal comments
Date: Wed, 30 Jan 2013 20:02:56 -0500
> Nowday freepascal is one of most widely used pascal compilers (after
> Delphi).  Although delphi-mode doesn't have described problem I thiks
> if there is separate pascal-mode it should work good. So problem
> should be fixed.

Indeed, I even extended the syntax-table facility so as to be able to
properly support the many different comment styles in Pascal.

I installed the patch below, which should do what you asked for.

I hope someone can try and merge delphi.el and pascal.el.  It can be
done step by step, e.g. by first making delphi.el a derived mode of
pascal.el and then moving delphi.el code to pascal.el bit by bit.


        Stefan


=== modified file 'lisp/progmodes/pascal.el'
--- lisp/progmodes/pascal.el	2013-01-01 09:11:05 +0000
+++ lisp/progmodes/pascal.el	2013-01-31 00:56:19 +0000
@@ -138,6 +138,9 @@
     ;; find about the syntax of Pascal's comments said that (* ... } is
     ;; a valid comment, just as { ... *) or (* ... *) or { ... }.
     (modify-syntax-entry ?* ". 23" st)
+    ;; Allow //...\n comments as accepted by Free Pascal.
+    (modify-syntax-entry ?/ ". 12c" st)
+    (modify-syntax-entry ?\n "> c" st)
     (modify-syntax-entry ?{ "<"    st)
     (modify-syntax-entry ?} ">"    st)
     (modify-syntax-entry ?+ "."    st)





bug marked as fixed in version 24.4, send any further explanations to 13585 <at> debbugs.gnu.org and vrt277 <vrt277 <at> gmail.com> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 04 Feb 2013 07:55:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 04 Mar 2013 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 168 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.