Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ident breaks for files starting with a shebang #27

Closed
etu opened this issue Nov 22, 2012 · 11 comments
Closed

Ident breaks for files starting with a shebang #27

etu opened this issue Nov 22, 2012 · 11 comments
Assignees
Labels

Comments

@etu
Copy link
Contributor

etu commented Nov 22, 2012

Yeah, I do scripting in PHP sometimes, and want to run them as executables like any other file.

The common way to do this is:

#!/usr/bin/env php
<?php
if(1 == 1) {
<tab>

Results in no indent.

@ejmr
Copy link
Collaborator

ejmr commented Nov 23, 2012

Sorry but I cannot replicate this. If I copy-paste the example you give then I do get indentation when I press Tab at that point. What version of Emacs are you using and what are the values of php-mode-version-number and php-mode-modified? That may help me replicate it. Thanks for bringing this up.

@etu
Copy link
Contributor Author

etu commented Nov 23, 2012

emacs: GNU Emacs 24.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.12) of 2012-11-06 on zarquon

php-mode-version-number: 1.6.6
php-mode-modified: 2012-09-06

@ejmr
Copy link
Collaborator

ejmr commented Nov 23, 2012

That will help a lot. Thanks.

@ejmr
Copy link
Collaborator

ejmr commented Nov 27, 2012

I switched back to the versions you described above and unfortunately still could not replicate this issue. So for the time being I am at a loss. However I am going to leave this bug open just in case someone runs into the same problem. There is another open issue related to indentation I need to address so I am hoping that I fix this issue too in the cross-fire.

@marcinant
Copy link
Contributor

I cannot duplicate this issue too.

On my Emacs 24.2.90.1 and php-mode 1.9 indentation is ok.

@ejmr
Copy link
Collaborator

ejmr commented Dec 12, 2012

Thanks for the report marcinant.

@etu I have asked a few friends to try out this issue on their machines and could not replicate it as well, so honestly I am at a loss. I am going to close this bug, however I keep a personal project todo-list in the folder and I am keeping this item on there, just so I will remember to keep an eye open for it. I'm sorry I haven't been able to figure out why it does not work for you the way it should. But there is a test case in the repository now so that I (and anyone else) can check to see if any future work done regarding indentation has an effect. Hopefully we'll figure this out soon.

@ejmr ejmr closed this as completed Dec 12, 2012
haxney added a commit to haxney/php-mode that referenced this issue Feb 8, 2013
ejmr pushed a commit that referenced this issue Feb 8, 2013
This massively cuts back on the elisp code needed.

Signed-off-by: Eric James Michael Ritz <lobbyjones@gmail.com>
ejmr pushed a commit that referenced this issue Feb 8, 2013
* haxney/tests-with-magic-comments:
  Use magic for tests of issues #14, #19, #27, #29, #42
  Use "magic" comments in PHP files to simplify indentation testing
@forthrin
Copy link

@ejmr: I regret to report this DOES still happen, in the worst possible way: Irreproducible. Retelling:

  1. Start with some code (1st example)
  2. Add braces around echo
  3. Press tab on echo line
  4. Incorrect indentation! (2nd example) -- but only when the tide is high in India
  5. Remove shebang line
  6. Repeat 3
  7. Correct indentation!
  8. Add shebang line
  9. Save, kill and re-open file
  10. Repeat 3
  11. Correct indentation! WTF!?

Can the fact the error goes away when you reopen the buffer help fix this pesky varmint?

#!/usr/bin/env php
<?php

$file = file_get_contents("file.txt");
$chunks = str_split($file, 256);
foreach($chunks as $chunk)
  echo base64_encode($chunk) . "\n";

?>
#!/usr/bin/env php
<?php

$file = file_get_contents("file.txt");
$chunks = str_split($file, 256);
foreach($chunks as $chunk) {
echo base64_encode($chunk) . "\n";
}

?>

@ejmr
Copy link
Collaborator

ejmr commented Mar 27, 2018

@forthrin I no longer maintain or work on PHP Mode, and nowadays usually do not respond to notifications about it, but I want to make sure @zonuexe is aware of this issue. He is the current maintainer, and more importantly he will do a much better job than me at figuring out a solution to this issue.

For what it's worth, I tried to duplicate the error again, yet again I could not. Some important info from the output of php-mode-debug:

--- PHP-MODE DEBUG BEGIN ---
PHP Mode 1.19.0 of 2018-03-26
versions: GNU Emacs 27.0.50 (build 2, x86_64-pc-linux-gnu, X toolkit)
 of 2018-03-25; PHP Mode 1.19.0 of 2018-03-26
major-mode: php-mode
minor-modes: (ivy-mode tooltip-mode electric-indent-mode
mouse-wheel-mode file-name-shadow-mode font-lock-mode
auto-composition-mode auto-encryption-mode auto-compression-mode
line-number-mode transient-mark-mode abbrev-mode)

[...]

@zonuexe Please let me know if any other info would help you in debugging this.

As an aside, maybe it would be a good idea to re-open this issue and also create a GitHub label like "Cannot Reproduce" or something similar, something to indicate that there is a bug but it is not one everyone can reliably duplicate.

@forthrin
Copy link

@emjr: @zonuexe: I don't have permission to reopen or tag the issue, but I'll help with any testing necessary. My guess is the bug doesn't depend on other .emacs settings. Mine is pretty simple.

@zonuexe zonuexe reopened this Mar 27, 2018
@zonuexe zonuexe self-assigned this Mar 27, 2018
@zonuexe
Copy link
Member

zonuexe commented Mar 27, 2018

@forthrin @ejmr Thanks for suggestion.
I would like to address this issue under the testimony of @forthrin.
This problem was marked as one of the issues to be addressed for the next stable release to be released.


(By the way, because I am not the owner of this repository, I can not receive notification of all issues from GitHub's features and mails. But since I use NotHub, if I am luckily in front of the computer I can detect all notifications at the same time. )

@zonuexe
Copy link
Member

zonuexe commented May 11, 2019

I'm closing it because it looks like there is no problem today.

@zonuexe zonuexe closed this as completed May 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants