unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15443: hs-forward-sexp design issue
@ 2013-09-23 11:10 Andreas Röhler
  2013-09-23 11:33 ` Andreas Schwab
  2015-12-26  0:59 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Andreas Röhler @ 2013-09-23 11:10 UTC (permalink / raw)
  To: 15443


hs-forward-sexp insists to be called with an argument

     (funcall hs-forward-sexp-func arg)))


That way it's not possible to instrument hs-forward-sexp-func just saying

(search-forward "something")

Instead

(lambda (arg)(search-forward "something"))

would be required.

As it's a function to be set by modes/users

life will be easier if this argument is optional.

Thanks!





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

* bug#15443: hs-forward-sexp design issue
  2013-09-23 11:10 bug#15443: hs-forward-sexp design issue Andreas Röhler
@ 2013-09-23 11:33 ` Andreas Schwab
  2013-09-23 13:13   ` Andreas Röhler
  2015-12-26  0:59 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2013-09-23 11:33 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: 15443

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

> hs-forward-sexp insists to be called with an argument
>
>     (funcall hs-forward-sexp-func arg)))
>
>
> That way it's not possible to instrument hs-forward-sexp-func just saying
>
> (search-forward "something")

This is not a function, so what are you trying to do?

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





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

* bug#15443: hs-forward-sexp design issue
  2013-09-23 11:33 ` Andreas Schwab
@ 2013-09-23 13:13   ` Andreas Röhler
  2013-09-23 13:16     ` Andreas Schwab
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Röhler @ 2013-09-23 13:13 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 15443

Am 23.09.2013 13:33, schrieb Andreas Schwab:
> Andreas Röhler <andreas.roehler@easy-emacs.de> writes:
>
>> hs-forward-sexp insists to be called with an argument
>>
>>      (funcall hs-forward-sexp-func arg)))
>>
>>
>> That way it's not possible to instrument hs-forward-sexp-func just saying
>>
>> (search-forward "something")
>
> This is not a function, so what are you trying to do?
>
> Andreas.
>

Did you look into the code in quesition?


hs-hide-block-at-point

calls

(hs-forward-sexp mdata 1)

with an hardcoded second argument "1"

And here the code of

(defun hs-forward-sexp (match-data arg)
   "Adjust point based on MATCH-DATA and call `hs-forward-sexp-func' w/ ARG.
Original match data is restored upon return."
   (save-match-data
     (set-match-data match-data)
     (goto-char (match-beginning hs-block-start-mdata-select))
     (funcall hs-forward-sexp-func arg)))


While hs-forward-sexp-func is to be set by mode/user

it will always be called with "1" as first argument.

Can't see any reason for this.






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

* bug#15443: hs-forward-sexp design issue
  2013-09-23 13:13   ` Andreas Röhler
@ 2013-09-23 13:16     ` Andreas Schwab
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2013-09-23 13:16 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: 15443

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

> Am 23.09.2013 13:33, schrieb Andreas Schwab:
>> Andreas Röhler <andreas.roehler@easy-emacs.de> writes:
>>
>>> hs-forward-sexp insists to be called with an argument
>>>
>>>      (funcall hs-forward-sexp-func arg)))
>>>
>>>
>>> That way it's not possible to instrument hs-forward-sexp-func just saying
>>>
>>> (search-forward "something")
>>
>> This is not a function, so what are you trying to do?
>>
>> Andreas.
>>
>
> Did you look into the code in quesition?

How is that relevant for my question?

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





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

* bug#15443: hs-forward-sexp design issue
  2013-09-23 11:10 bug#15443: hs-forward-sexp design issue Andreas Röhler
  2013-09-23 11:33 ` Andreas Schwab
@ 2015-12-26  0:59 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2015-12-26  0:59 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: 15443

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

> hs-forward-sexp insists to be called with an argument
>
>     (funcall hs-forward-sexp-func arg)))
>
> That way it's not possible to instrument hs-forward-sexp-func just saying
>
> (search-forward "something")
>
> Instead
>
> (lambda (arg)(search-forward "something"))
>
> would be required.
>
> As it's a function to be set by modes/users
>
> life will be easier if this argument is optional.

The argument has to be a function -- it can't just be a form.  That
would be very odd.  So I don't think there's anything to do here, and
I'm closing the bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2015-12-26  0:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-23 11:10 bug#15443: hs-forward-sexp design issue Andreas Röhler
2013-09-23 11:33 ` Andreas Schwab
2013-09-23 13:13   ` Andreas Röhler
2013-09-23 13:16     ` Andreas Schwab
2015-12-26  0:59 ` Lars Ingebrigtsen

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

	https://git.savannah.gnu.org/cgit/emacs.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).