Nested codes with long identifiers

Writing predicates with long identifiers, I often prefer (A) to (B) for readablity. However, with default behavior of Emacs in prolog-mode for <Return> key, codes on the buffer looks like (B). Is there any simple setting for (A). Or do I need to write an emacs-lisp function for (A) ?

(A)

pred :- call_with_time_limit(setup-call_cleanup(
		longlonglonglong_arg_A,
		longlonglonglong_arg_B,
		longlonglonglong_arg_C)).

(B)

pred :- call_with_time_limit(
							 setup-call_cleanup(
												longlonglonglongargA,
												longlonglonglongargB,
												longlonglonglongargC)).

Kuniaki Mukai

As is, PceEmacs can only do

longid(a,b,c)
longid(a,
       b,
       c)
longid(
    a,
    b,
    c)

The only option to this is that you can set the indentation in the last version (default 4). I don’t think I’ve ever seen your (B). It is probably not that hard to add, but it would conflict with the 3rd option above. I think it is up to you :slight_smile: If I recall well the source is in xpce/prolog/lib/emacs/language_mode.pl, probably called something like ->indent_line.

The recommended emacs prolog.el has customization prolog-left-indent-regexp … maybe you can modify this?

I loads into Emacs.app many lisp packages without reading documents. Now I suspect there is conflict between lisp-mode and prolog-mode. (B) seems a lisp way. I should check it. Anyway also I like PceEmacs way. Thanks.

Kuniaki Mukai

In stead of reading doc, I have defined a shortcut to insert “\n\t” or “\n” into the emacs buffer depending on whether prolog-mode or not. It is informal, I know, but informal is normal with my use of Emacs.

(global-set-key (kbd "<C-return>")
				'(lambda () (interactive)
				   (if (string-equal major-mode "prolog-mode")
					   (insert  "\n\t")
					   (insert "\n"))))

I use ediprolog.el for a long time without any modification. I am not sure whether it
allows customizing auto indentatio. I will check it. Thank you.

K. Mukai